zjquery: Mock text more accurately.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2020-02-12 02:27:02 -08:00 committed by showell
parent 483f1d153d
commit d16a730d81
1 changed files with 5 additions and 3 deletions

View File

@ -329,9 +329,11 @@ exports.make_new_elem = function (selector, opts) {
stop: function () { stop: function () {
return self; return self;
}, },
text: function (arg) { text: function (...args) {
if (arg !== undefined) { if (args.length !== 0) {
text = arg; if (args[0] !== undefined) {
text = args[0].toString();
}
return self; return self;
} }
return text; return text;