Skip to content

Commit

Permalink
make test safer and more meaningful
Browse files Browse the repository at this point in the history
  • Loading branch information
5saviahv committed Jan 5, 2021
1 parent 89b9271 commit 906ca89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion test/api/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,11 @@ describe('$(...)', function () {
balls: 'giandor',
});
// Adding as string.
var b = $('.linth').data('snack', 'chocoletti').data(4, 'chocoletti');
var b = $('.linth').data('snack', 'chocoletti');

expect(function () {
a.data(4, 'throw');
}).not.toThrow();
expect(a.data('balls')).toStrictEqual('giandor');
expect(b.data('snack')).toStrictEqual('chocoletti');
});
Expand Down
8 changes: 6 additions & 2 deletions test/cheerio.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,15 @@ describe('cheerio', function () {
});

it('cloneDom : should be able clone single Elements', function () {
var main = cheerio('<p>Cheerio</p>');
var result = [];
utils.domEach(cheerio('<p>A</p><p>B</p>'), function (i, el) {
utils.domEach(main, function (i, el) {
result = result.concat(utils.cloneDom(el));
});
expect(result).toHaveLength(2);
expect(result).toHaveLength(1);
expect(result[0]).not.toBe(main[0]);
expect(main[0].children.length).toBe(result[0].children.length);
expect(cheerio(result).text()).toBe(main.text());
});

it('isHtml function test', function () {
Expand Down

0 comments on commit 906ca89

Please sign in to comment.