/
kopython
/
_hyperscript
Обзор
Документация
Войти
/
kopython
/
_hyperscript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/expressions/functionCalls.js
68 строк
1 KB
Deniz Akşimşek
increase line width
27 май 2021, 22:16
27 май 2021, 22:16
59ea0c5
Код
Авторство
О чём код?
describe("function call expressions", function () { it("can invoke global function", function () { window.identity = function (x) { return x; }; try { var result = evalHyperScript('identity("foo")'); result.should.equal("foo"); } finally { delete window.identity; } }); it("can invoke function on object", function () { window.obj = { value: "foo", getValue: function () { return this.value; }, }; try { var result = evalHyperScript("obj.getValue()"); result.should.equal("foo"); } finally { delete window.obj; } }); it("can invoke global function w/ async arg", function (done) { window.identity = function (x) { return x; }; var result = evalHyperScript("identity(promiseAnIntIn(10))"); result.then(function (result) { result.should.equal(42); delete window.identity; done(); }); }); it("can invoke function on object w/ async arg", function (done) { window.obj = { identity: function (x) { return x; }, }; var result = evalHyperScript("obj.identity(promiseAnIntIn(10))"); result.then(function (result) { result.should.equal(42); delete window.obj; done(); }); }); it("can invoke function on object w/ async root & arg", function (done) { window.obj = { identity: function (x) { return x; }, }; var result = evalHyperScript("promiseValueBackIn(obj, 20).identity(promiseAnIntIn(10))"); result.then(function (result) { result.should.equal(42); delete window.obj; done(); }); }); });