here is the code:
(function(){
"use strict";
angular.module("dataModule")
       .controller("panelController", ["$scope", "$state", "$timeout", "$modal", panelController]);
function panelController($scope, $state, $timeout, $modal){
    $scope.property = "panelController";
    //how do we do unit test on openCancelWarning.
    //i did not find a way to get openCancelWarning function in Jasmine.
    function openCancelWarning () {
        var cancelModal = $modal.open({
            animation: true,
            backdrop: "static",
            templateUrl: "pages/data/cancel-warning.html",
            controller: "cancelWarningController",
            size: "sm",
            resolve: {
                items : function() {
                    return {
                        warningTitle : "Are you Sure?",
                        warningMessage: "There are unsaved changes on this page. are you sure you want to navigate away from this page?Click OK to continue or Cancel to stay on this page"
                    };
                }
            }
        });
        return cancelModal;
    }
    var resultPromise = openCancelWarning();
    var result;
    resultPromise.result.then(function(response){
            result = response;
    }); 
}
angular.module("dataModule")
       .controller("cancelWarningController", ["$scope", "$modalInstance", "items", cancelWarningController]);
function cancelWarningController($scope, $modalInstance, items){
    $scope.warningTitle = items.warningTitle;
    $scope.warningMessage = items.warningMessage;
    $scope.cancel = function() {
        $modalInstance.close(false);
    };
    $scope.ok = function() {
        $modalInstance.close(true);
    };
}
}());
here is my jasmine unit test code.
describe("Controller: panelController", function () {
beforeEach(module("dataModule"));
var panelController, scope;
var fakeModal = {
    result : {
        then: function(confirmCallback) {
            this.confirmCallback = confirmCallback;
        }
    },
    close: function(confirmResult) {
        this.result.confirmCallback(confirmResult);
    }
};
beforeEach(inject(function($modal) {
    spyOn($modal, "open").andReturn(fakeModal);
}));
beforeEach(inject(function ($controller, $rootScope, _$modal_) {
    scope = $rootScope.$new();
    panelController = $controller("panelController", {
        $scope: scope,
        $modal: _$modal_
    });
}));
it('test should be true', function () {        
    var test;
    var testResult = panelController.openCancelWarning();
    testResult.close(true);
    testResult.then(function(response){
        test=response;
    });
    expect(test).toBe(true);      
});
});
i wrote above unit test code with the help from Mocking $modal in AngularJS unit tests i always get below error.
TypeError: 'undefined' is not a function (evaluating 'panelController.openCancelWarning()')
could anyone help this?
 
    