postcss-pseudo-companion-classes
Version:
PostCSS plugin to add companion classes to pseudo-classes for testing purposes (works with css modules)
136 lines (105 loc) • 1.72 kB
CSS
:root {
color: blue;
}
::selection {
background-color: mintcream;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
font-weight: bold;
}
a:hover,
a:focus {
font-weight: bold;
}
a.lol:active {
font-weight: normal;
}
a:nth-child(5) {
border: 1px solid papayawhip;
}
a:hover:focus {
font-weight: bold;
}
a:before {
color: white;
}
a::before {
color: white;
}
a:before,
a::before {
color: white;
}
a:hover::before {
border-top-color: blue;
}
a:active:focus:hover::after {
border-bottom-color: blue;
}
a:active:focus + div:hover {
color: magenta;
}
:global a {
border-top-color: burlywood;
}
:global(a) {
color: firebrick;
}
:global a:hover {
color: peachpuff;
}
:global a:hover b:focus {
color: thistle;
}
:global(a:hover) {
color: cadetblue
}
:global(a:hover) b:focus {
color: whitesmoke;
}
:host {
color: blue;
}
:host-context(a) {
color: blue;
}
:host([disabled]) {
opacity: .4;
}
:host([enabled]) {
opacity: 1;
}
a:hover, :host {
color: blue;
}
.block .element:active {
color: blue;
}
:host .block .element:active {
color: blue;
}
/*test multiple pseudo classes on one element but one is excluded (:host)
no useful css rule, but another pseudo class, like :nth-child could be added
by the user.
*/
.element:host:active {
color:blue
}
/*test :host (excluded) with modifier class on host (element)*/
.hostVariant:host .block .element:active {
color: blue;
}
/*test :host (excluded) with modifier class on host (element)*/
:host.hostVariant .block .element:active {
color: blue;
}
/*test :host (excluded) with id on host (element)*/
:host#specialVariantId .block .element:active {
color: blue;
}