dalekjs / dalek

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

Checking computed style but test return % #126

Open piermariacosina opened 10 years ago

piermariacosina commented 10 years ago

in the documentation "Checks the computed style. Note: When selecting values like em or percent, they will be converted to px. So it's currently not possible to check em, %, ... values, only px."

but during tests Running Browser: PhantomJS OS: mac unknown 32bit Browser Version: 1.9.7 ✘ CSS 0 EXPECTED: 385px 0 FOUND: 70% ✘ TEST - "SIDE link position is correct" FAILED

seams that it is taking the % and not the computed style

piermariacosina commented 10 years ago

From further tests seams that depending on the browser the test give different result in px or %

asciidisco commented 10 years ago

Hmm,

that is very interesting; I was aware of another Bug that was similar, PhantomJS was returning rgb() & Chrome rgba() when requesting a color. This seems like a non specified behaviour in the CSSOM. Will try to find a comparison somewhere on the web.

rodneyrehm commented 10 years ago

Different browsers report different things for different kinds of colors. The only way to work with colors is by using something like chromath to parse any kind of color-notation and then provide comparison functions (for approximation et al). In skaro this could be provided through an is.color expectation.

Munter commented 10 years ago

For color detection, parsing and comparison I have written https://github.com/Munter/pipetteur The returned color object is an instance of https://github.com/One-com/one-color which had a proper diff method and implicit conversions, making it very easy to test if something is a color, and if it's the correct one.

rodneyrehm commented 10 years ago

related: #50