dalekjs / dalek

[unmaintained] DalekJS Base framework
MIT License
695 stars 63 forks source link

numberOfElements fails with 0 elements found #93

Open asciidisco opened 10 years ago

asciidisco commented 10 years ago

Original issue from @Kai-M:

When doing a

test.assert.numberOfElements('.elements',0,'well done')
dalek skips the assertion and "well done" will never be displayed.

Dalek even denys the existence of the assertions. 
Lets say you have 2 assertions with a non-zero value and you got dozens of 0 assertions, dalek will output "x/2 assertions passed"!
asciidisco commented 10 years ago

Yep, it seems that this is due to the fact that we can't do a strict type checking there (yet) and 0 is a falsy value in JavaScript. Will be fixed in a future version.

Wianco commented 10 years ago

We have the same problem with NumberOfVisibleElements, so currently we're testing with the following workaround: .numberOfVisibleElements.is.lt('#element .class', 1, '0 elements visible')

-> number of elements is less than 1

Best regards, Michael Wilczynska.

Better IT, Better Solutions - Wianco Solution Group. http://www.Wianco.com