jamesshore / quixote

CSS unit and integration testing
Other
848 stars 45 forks source link

Test pseudo elements #53

Open hrishikeshpotdar91 opened 5 years ago

hrishikeshpotdar91 commented 5 years ago

Edit by jamesshore: See below for a technique for testing psuedo elements.

I'm trying to fetch ::before's css of an element but i always get the following error

"Expected one element to match '.callout .alert::before', but found 0"

this is what I'm doing

callout_icon = frame.get('.callout .alert::before');

can you help me doing this the right way

jamesshore commented 5 years ago

Unfortunately, there's no way to test pseudo-elements at this time.

hrishikeshpotdar91 commented 5 years ago

I was able to test pseudo-elements like this

callout__primary = frame.get('.callout .primary');

expect(window.getComputedStyle(callout__primary.toDomElement(), '::before').getPropertyValue('content')).to.be('"\􎀼"')

This article helped me https://davidwalsh.name/pseudo-element

jamesshore commented 5 years ago

Very interesting! I'll re-open this as a feature request for the future.