Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions test-app/app/src/main/assets/app/tests/testsForTypescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,27 @@ describe("Tests typescript", function () {
expect(isInstanceOf).toEqual(true);
});

it("When_a_typescript_class_without_a_constructor_is_created_with_arguments_it_should_pass_them_to_the_java_constructor", function () {

// TypeScript's output for `class NamedThread extends java.lang.Thread {}`.
var NamedThread = (function (_super) {
__extends(NamedThread, _super);
function NamedThread() {
return _super !== null && _super.apply(this, arguments) || this;
}
NamedThread.prototype.run = function () {
};
return NamedThread;
})(java.lang.Thread);

var thread = new NamedThread("named");
expect(thread instanceof NamedThread).toBe(true);
expect(thread.getName()).toBe("named");

var unnamed = new NamedThread();
expect(unnamed instanceof NamedThread).toBe(true);
});

it("When_creating_a_typescript_instance_it_should_support_member_access", function () {

__log("TEST: When_creating_a_typescript_instance_it_should_support_member_access");
Expand Down
2 changes: 1 addition & 1 deletion test-app/app/src/main/assets/internal/ts_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
var Extended = extend(thiz);
thiz.__container__ = true;
if (args && args.length > 0) {
thiz.__proto__ = new (Function.prototype.bind.apply(Extended, [null].concat(args)));
thiz.__proto__ = new (Function.prototype.bind.apply(Extended, [null].concat(Array.prototype.slice.call(args))));
}
else {
thiz.__proto__ = new Extended();
Expand Down