Skip to content

Commit 8f27a3c

Browse files
committed
fix converter test
1 parent e8baf71 commit 8f27a3c

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

src/test/converter.test.js

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -583,21 +583,34 @@ describe('converter', () => {
583583
expect(result[0]).toBe('militaria.pl#$##layout-wrapper::after { height:0!important }');
584584
});
585585

586-
// FIXME: check
587-
// it('does not convert mess pseudos with scriptlets', () => {
588-
// let rule;
589-
// let result;
590-
591-
// rule = 'example.org#$#selector:style()';
592-
// result = convertRulesToAdgSyntax([rule]);
593-
// expect(result).toHaveLength(1);
594-
// expect(result).toContain(rule);
595-
596-
// rule = 'yamareco.com#$#body.header_bg_ad.modal-open:style(padding-right: auto !important;overflow: auto!important)';
597-
// result = convertRulesToAdgSyntax([rule]);
598-
// expect(result).toHaveLength(1);
599-
// expect(result).toContain(rule);
600-
// });
586+
it('does not convert mess pseudos with scriptlets', () => {
587+
let rule;
588+
let result;
589+
const excluded = [];
590+
591+
rule = 'example.org#$#selector:style()';
592+
result = convertRulesToAdgSyntax([rule], excluded);
593+
expect(result).toHaveLength(0);
594+
expect(excluded).toHaveLength(2);
595+
expect(excluded).toEqual(
596+
[
597+
'! Unable to convert rule to AdGuard syntax: "example.org#$#selector:style()" due to error: \'AdblockPlus\' syntax cannot be mixed with \'UblockOrigin\' syntax',
598+
'example.org#$#selector:style()',
599+
],
600+
);
601+
602+
rule = 'yamareco.com#$#body.header_bg_ad.modal-open:style(padding-right: auto !important;overflow: auto!important)';
603+
excluded.length = 0;
604+
result = convertRulesToAdgSyntax([rule], excluded);
605+
expect(result).toHaveLength(0);
606+
expect(excluded).toHaveLength(2);
607+
expect(excluded).toEqual(
608+
[
609+
'! Unable to convert rule to AdGuard syntax: "yamareco.com#$#body.header_bg_ad.modal-open:style(padding-right: auto !important;overflow: auto!important)" due to error: \'AdblockPlus\' syntax cannot be mixed with \'UblockOrigin\' syntax',
610+
'yamareco.com#$#body.header_bg_ad.modal-open:style(padding-right: auto !important;overflow: auto!important)',
611+
],
612+
);
613+
});
601614
});
602615

603616
// FIXME: fix tests

0 commit comments

Comments
 (0)