From 2dc84d526aa9c90e95d1326a73499de1bae32a3f Mon Sep 17 00:00:00 2001 From: Ryc O'Chet Date: Wed, 22 Apr 2015 15:20:37 +0100 Subject: [PATCH] Add tests for setting text and html as non-strings --- test/cheerio.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/cheerio.js b/test/cheerio.js index 507422e49d..9a515e80a0 100644 --- a/test/cheerio.js +++ b/test/cheerio.js @@ -227,6 +227,18 @@ describe('cheerio', function() { expect($empty.each).to.be($.prototype.each); }); + it('should set html(number) as a string', function() { + var $elem = $('
'); + $elem.html(123); + expect(typeof $elem.text()).to.equal('string'); + }); + + it('should set text(number) as a string', function() { + var $elem = $('
'); + $elem.text(123); + expect(typeof $elem.text()).to.equal('string'); + }); + describe('.load', function() { it('should generate selections as proper instances', function() {