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 () {
return self;
},
text: function (arg) {
if (arg !== undefined) {
text = arg;
text: function (...args) {
if (args.length !== 0) {
if (args[0] !== undefined) {
text = args[0].toString();
}
return self;
}
return text;