Skip to content

Commit

Permalink
test: Add test for #1092 (#1733)
Browse files Browse the repository at this point in the history
Fixes #1092
  • Loading branch information
5saviahv authored Feb 13, 2021
1 parent 040f8ff commit 1a86118
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/cheerio.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,15 @@ describe('cheerio', function () {
expect($('.apple')).toBeInstanceOf($);
});

// issue #1092
it('should handle a character `)` in `:contains` selector', function () {
var result = cheerio.load('<p>)aaa</p>')(":contains('\\)aaa')");
expect(result).toHaveLength(3);
expect(result.first().prop('tagName')).toBe('HTML');
expect(result.eq(1).prop('tagName')).toBe('BODY');
expect(result.last().prop('tagName')).toBe('P');
});

it('should be able to filter down using the context', function () {
var $ = cheerio.load(fruits);
var apple = $('.apple', 'ul');
Expand Down

0 comments on commit 1a86118

Please sign in to comment.