have_css / have_selector capybara tricks
Match Tailwind pseudo class
<input type="radio" class="checked:bg-red-500" checked="checked"/>
expect(comp).to have_selector('.checked\:tw-bg-primary-600') #works expect(comp).to have_selector(%q(.checked\:tw-bg-primary-600)) #works expect(comp).to have_selector(".checked\:tw-bg-primary-600") # double quotes won't work due to interpolation
Partial match using starĀ
<img src="https://eq8.eu/images/just_name.png?abc=123" alt="bla">
expect(page).to have_css(img[src*='just_name.png'][alt=bla]