jasmine-jquery icon indicating copy to clipboard operation
jasmine-jquery copied to clipboard

.toHaveCss() - cant use integer values because of value.replace() is not a function

Open DemersM opened this issue 8 years ago • 0 comments

Im trying to use toHaveCss() matcher with integer values:

expect($('<div style="position:fixed; bottom:0; left:0; right:0; top:0; z-index:10001;"></div>').toHaveCss({bottom: 0, top: 0});

>>>TypeErroTypeError: value.replace is not a function in http://localhost:8080/tests/lib/jasmine/jasmine-jquery.js (line 394)

Ok, I understand the error, Integer dont have replace() function, but if try with string instead the test fails:

expect($('<div style="position:fixed; bottom:0; left:0; right:0; top:0; z-index:10001;"></div>').toHaveCss({bottom: "0", top: "0"});

Expected ({ 0: HTMLNode, length: 1 }) to have css Object({ bottom: '0', top: '0' }).

Is there a way to use that matcher with integer values? P.S.: top could have string value such "0px" but, z-index cant, so this matcher should handle integer and float.

DemersM avatar Feb 26 '16 20:02 DemersM