Skip to content

Commit

Permalink
Merge 40e8205 into efcba05
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Aug 14, 2021
2 parents efcba05 + 40e8205 commit f5a30c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/api/manipulation.spec.ts
Expand Up @@ -1901,6 +1901,11 @@ describe('$(...)', () => {
expect(text).toBe('M&M');
});

it('should turn passed values to strings', () => {
$('.apple').text(1 as any);
expect($('.apple')[0].childNodes[0]).toHaveProperty('data', '1');
});

it('( undefined ) : should act as an accessor', () => {
const $div = $('<div>test</div>');
expect(typeof $div.text(undefined as any)).toBe('string');
Expand Down
2 changes: 1 addition & 1 deletion src/api/manipulation.ts
Expand Up @@ -1004,7 +1004,7 @@ export function text<T extends Node>(
child.next = child.prev = child.parent = null;
});

const textNode = new Text(str);
const textNode = new Text(`${str}`);

updateDOM(textNode, el);
});
Expand Down

0 comments on commit f5a30c7

Please sign in to comment.