mercredi 22 novembre 2017

Check class names of nested divs || Ember/Mocha/Chai tests?

So I am writing integration tests using Mocha and Chai. I am new to tests.

Long story short.

I installed couple Chai jQuery plugins like chai-dom , chai-jq and chai-jquery.

I am running the tests by "ember test --server"

I have a div with a ".navigation" class. This div has three nested divs, each with a unique class.

In my tests, I am checking if the parent div exists:

should.exist('.navigation');

How can I "expect" the other 3 nested divs to have the classes I want?

I want something like:

expect($('.navigation)).children[0].to.have.class('flex1')

OR

expect($('.navigation)).children().to.have.class('flex1, flex2, flex3')

OR

expect($('.navigation)).descendants.to.have.class('flex1, flex2, flex3')

Something like that..?

Same goes to IDs I believe?

Thank you in advance.

Mo.




Aucun commentaire:

Enregistrer un commentaire