mardi 28 février 2017

How to assert if an element exists in angular?

I am writing a spec for a directive. As part of the testing, I need to assert if an element with a class exists inside my root directive component.

I have tried the following.

it('should have a loading div container', function() {
            var loadingDivContainer = element.find('.loading-div');
            expect(loadingDivContainer).to.exist;
        });

But this seems to pass in all the condition. I am using the following tech.

Angular 1.x, mocha, chai,

Aucun commentaire:

Enregistrer un commentaire