dimanche 26 juillet 2015

Is there a way to Unit test HTML element's value?

I am new to angularjs ,trying to test HTML elements but can't find a way.I am using Karma and jasmine for testing.Can anyone tell me how can i test HTML element's value or text in angularjs. Here is my controllerspec:

describe('myAppCtrl', function() {

    var scope, controller, httpBackend;

    beforeEach(module('myApp'));

    beforeEach(inject(function($rootScope, $controller, $httpBackend) {
        scope = $rootScope;
        controller = $controller;
        httpBackend = $httpBackend;
    }));


    it('should show the text of element',function() {
        expect($('#testtext')).toBe('First Angular JS App');
    }); 

});

Aucun commentaire:

Enregistrer un commentaire