Skip to content

Commit

Permalink
added: patch to solve riot/riot#2972 and riot/riot#2967
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaGuarini committed Nov 4, 2022
1 parent 19d5913 commit be86289
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/generators/css/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const CSS_SELECTOR = RegExp(`([{}]|^)[; ]*((?:[^@ ;{}][^{}]*)?[^@ ;{}:] ?)(?={)|
* @const {RegExp}
*/

const CSS_SELECTOR_LIST = /([^,]+)(?::\w+(?:[\s|\S]*?\))?\s?)+|([^,]+)/g
const CSS_SELECTOR_LIST = /([^,]+)*(?::\w+(?:[\s|\S]*?\))?(?:[^,:]+)?)+|([^,]+)/g

/**
* Scope the css selectors prefixing them with the tag name
Expand Down
2 changes: 2 additions & 0 deletions test/generators/css.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe('Generators - CSS', () => {
expect(addScopeToSelectorList('my-tag', 'my-tag:hover')).to.be.equal('my-tag:hover')
expect(addScopeToSelectorList('my-tag', ':host')).to.be.equal('my-tag,[is="my-tag"]')
expect(addScopeToSelectorList('my-tag', ':host:hover')).to.be.equal('my-tag:hover,[is="my-tag"]:hover')
expect(addScopeToSelectorList('my-tag', ':host:hover > ul > li')).to.be.equal('my-tag:hover > ul > li,[is="my-tag"]:hover > ul > li')
expect(addScopeToSelectorList('my-tag', 'input')).to.be.equal('my-tag input,[is="my-tag"] input')
expect(addScopeToSelectorList('my-tag', '.foo, .bar')).to.be.equal('my-tag .foo,[is="my-tag"] .foo,my-tag .bar,[is="my-tag"] .bar')
expect(addScopeToSelectorList('my-tag', '.foo:hover, .foo:focus')).to.be.equal('my-tag .foo:hover,[is="my-tag"] .foo:hover,my-tag .foo:focus,[is="my-tag"] .foo:focus')
Expand All @@ -157,6 +158,7 @@ describe('Generators - CSS', () => {
expect(addScopeToSelectorList('my-tag', '.foo:not(.bar,.baz)')).to.be.equal('my-tag .foo:not(.bar,.baz),[is="my-tag"] .foo:not(.bar,.baz)')
expect(addScopeToSelectorList('my-tag', '.foo:where(.bar,.baz)')).to.be.equal('my-tag .foo:where(.bar,.baz),[is="my-tag"] .foo:where(.bar,.baz)')
expect(addScopeToSelectorList('my-tag', '.foo:is(.bar,.baz)')).to.be.equal('my-tag .foo:is(.bar,.baz),[is="my-tag"] .foo:is(.bar,.baz)')
expect(addScopeToSelectorList('my-tag', '.foo:is(.bar,.baz) a')).to.be.equal('my-tag .foo:is(.bar,.baz) a,[is="my-tag"] .foo:is(.bar,.baz) a')
expect(addScopeToSelectorList('my-tag', '.foo :is(.bar,.baz) :is(.d, .e)')).to.be.equal('my-tag .foo :is(.bar,.baz) :is(.d, .e),[is="my-tag"] .foo :is(.bar,.baz) :is(.d, .e)')
expect(addScopeToSelectorList('my-tag', '.foo:is(.bar,.baz), .bar')).to.be.equal('my-tag .foo:is(.bar,.baz),[is="my-tag"] .foo:is(.bar,.baz),my-tag .bar,[is="my-tag"] .bar')
})
Expand Down

0 comments on commit be86289

Please sign in to comment.