Skip to content

Commit

Permalink
fix test and improve hostSelector arg description
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Jan 18, 2023
1 parent 5443317 commit 0b78ff2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/scriptlets/inject-css-in-shadow-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
* ```
*
* - `cssRule` - required, string representing a single css rule
* - `hostSelector` - optional, string, selector to match `ShadowRoot` host element of which shadow doms should be injected with css.
* - `hostSelector` - optional, string, selector to match shadow host elements. CSS rule will be only applied to shadow roots inside this element.
* Defaults to injecting css rule into all available roots.
*
* **Examples**
Expand Down
10 changes: 4 additions & 6 deletions tests/scriptlets/inject-css-in-shadow-dom.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,12 @@ if (!isSupported) {
test('do not apply invalid style, logged correctly', (assert) => {
assert.expect(3);
console.log = function log(input) {
if (input.indexOf('trace') > -1) {
if (typeof input !== 'string' || input.indexOf('trace') > -1) {
return;
}
assert.strictEqual(
input,
`${name}: Failed to parse the rule: ${INVALID_CSS_TEXT}`,
'message logged correctly',
);

const logMessage = `${name}: Unable to apply the rule '${INVALID_CSS_TEXT}' due to:`;
assert.ok(input.startsWith(logMessage), 'message logged correctly');
};

runScriptlet(name, [INVALID_CSS_TEXT]);
Expand Down

0 comments on commit 0b78ff2

Please sign in to comment.