Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test createDialog in jasmine? #28

Open
hemantmali21 opened this issue Jun 24, 2014 · 0 comments
Open

How to test createDialog in jasmine? #28

hemantmali21 opened this issue Jun 24, 2014 · 0 comments

Comments

@hemantmali21
Copy link

Hi,
I have used the createDialog service of fundoo solutions to show the pop up modal.I want to test the my delete functionality using jasmine.How to do that? please help.
Here is my code:
$scope.deleteProject = function (id) {

createDialog('/App/Modules/ReadAdmin/Projects/Templates/deleteproject.html', {

id: 'DeleteProjectDialog',

title: 'Delete Project',

backdrop: true,

controller: 'DetailCtrl',

success: { label: 'Proceed', fn: function () { projectService.delete({ id: id }); } },

cancel: { label: 'Cancel', fn: function () { console.log("Delete modal closed"); } }

},

{

id: id

});

};

//Details controller

projectApp.controller('DetailCtrl', function ($scope, projectService, id) {

$scope.project = projectService.get({ id: id });

});

//This is my test

it('should delete the project', function () {

$httpBackend.expectGET(api/projects).respond([{ id: 100, code: "B100", "name": "ABC"}]);

$httpBackend.expectDELETE(api/projects/100').respond({});

var ctrl = $controller('DetailCtrl', { $scope: $scope, projectService: mockprojectService,createDialog:dialogService });

$scope.deleteProject(100);
$httpBackend.flush();

expect(mockprojectService.delete).toHaveBeenCalled();

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant