Skip to content

Commit e3421f6

Browse files
authored
Merge pull request #1317 from NativeScript/vmutafov/sbg-refactoring-beta
Refactor static binding generator
2 parents 028246c + 608dd7d commit e3421f6

File tree

95 files changed

+4211
-1349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+4211
-1349
lines changed

test-app/app/src/main/assets/app/MyActivity.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ var MyActivity = (function (_super) {
5656
button.setBackgroundColor(colors[taps % colors.length]);
5757
taps++;
5858
}}));
59+
5960
};
6061
MyActivity = __decorate([
6162
JavaProxy("com.tns.NativeScriptActivity")

test-app/app/src/main/assets/app/mainpage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ require("./tests/testGC");
4242
require("./tests/testsMemoryManagement");
4343
require("./tests/testFieldGetSet");
4444
require("./tests/extendedClassesTests");
45-
require("./tests/extendClassNameTests");
45+
//require("./tests/extendClassNameTests"); // as tests now run with SBG, this test fails the whole build process
4646
require("./tests/testJniReferenceLeak");
4747
require("./tests/testNativeModules");
4848
require("./tests/requireExceptionTests");
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
describe("Tests extend class name ", function () {
2-
2+
33
var myCustomEquality = function(first, second) {
44
return first == second;
55
};
6-
6+
77
beforeEach(function() {
88
jasmine.addCustomEqualityTester(myCustomEquality);
99
});
10-
11-
//the class name valid symbols are [a-z , A-Z , 0-9, _]
12-
it("When_naming_extension_class_user_should_give_valid_name", function () {
13-
14-
var exceptionCaught = false;
15-
try
16-
{
17-
var O = java.lang.Object.extend("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", {});
18-
}
19-
catch(e)
20-
{
21-
exceptionCaught = true;
22-
__log("Validation is wrong");
23-
}
2410

25-
expect(exceptionCaught).toBe(false);
26-
});
27-
28-
it("When_naming_extension_contains_invalid_symbols_should_throw_exception", function () {
29-
30-
var exceptionCaught = false;
31-
try
32-
{
33-
var O = java.lang.Object.extend("1235!", {}); //[!] is invalid symbol
34-
}
35-
catch(e)
36-
{
37-
__log('message: ' + e.message);
38-
exceptionCaught = true;
39-
}
40-
41-
expect(exceptionCaught).toBe(true);
42-
});
11+
//the class name valid symbols are [a-z , A-Z , 0-9, _]
12+
// it("When_naming_extension_class_user_should_give_valid_name", function () {
13+
//
14+
// var exceptionCaught = false;
15+
// try
16+
// {
17+
// var O = java.lang.Object.extend("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789", {});
18+
// }
19+
// catch(e)
20+
// {
21+
// exceptionCaught = true;
22+
// __log("Validation is wrong");
23+
// }
24+
//
25+
// expect(exceptionCaught).toBe(false);
26+
// });
27+
//
28+
// it("When_naming_extension_contains_invalid_symbols_should_throw_exception", function () {
29+
//
30+
// var exceptionCaught = false;
31+
// try
32+
// {
33+
// var O = java.lang.Object.extend("1235!", {}); //[!] is invalid symbol
34+
// }
35+
// catch(e)
36+
// {
37+
// __log('message: ' + e.message);
38+
// exceptionCaught = true;
39+
// }
40+
//
41+
// expect(exceptionCaught).toBe(true);
42+
// });
4343
});

test-app/app/src/main/assets/app/tests/extendedClassesTests.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ describe("Tests extended classes ", function () {
1313
var labelToString = button.toString();
1414
var labelgetIMAGE_ID_PROP = button.getIMAGE_ID_PROP();
1515
//
16-
16+
1717
var button1 = new com.tns.tests.Button1();
1818
var labelToString1 = button1.toString();
1919
var labelgetIMAGE_ID_PROP1 = button1.getIMAGE_ID_PROP();
20-
20+
2121
expect(labelToString).not.toBe(labelToString1);
2222
expect(labelgetIMAGE_ID_PROP).not.toBe(labelgetIMAGE_ID_PROP1);
2323
});
@@ -81,9 +81,9 @@ describe("Tests extended classes ", function () {
8181

8282
expect(Child.extend()).toBe("expectedValue");
8383
});
84-
84+
8585
it("Instance with extension shouldn't use previously defined implementation object", function () {
86-
86+
8787
var MyButton = com.tns.tests.Button1.extend({
8888
toString: function () {
8989
return "overriden toString method of button instance";
@@ -96,7 +96,7 @@ describe("Tests extended classes ", function () {
9696
var labelToString = button.toString();
9797
var labelgetIMAGE_ID_PROP = button.getIMAGE_ID_PROP();
9898
//
99-
99+
100100
var MyButton1 = com.tns.tests.Button1.extend({
101101
toString: function () {
102102
return "overriden toString method of button1 instance ";
@@ -112,12 +112,12 @@ describe("Tests extended classes ", function () {
112112
expect(labelToString).not.toBe(labelToString1);
113113
expect(labelgetIMAGE_ID_PROP).not.toBe(labelgetIMAGE_ID_PROP1);
114114
});
115-
115+
116116
it("Newly created instances should behave the same and not use previously defined implementation objects", function () {
117117

118118
var button1 = new com.tns.tests.Button1();
119119
var labelgetIMAGE_ID_PROP1 = button1.getIMAGE_ID_PROP();
120-
120+
121121
//
122122
var MyButton = com.tns.tests.Button1.extend({
123123
getIMAGE_ID_PROP: function () {
@@ -127,10 +127,10 @@ describe("Tests extended classes ", function () {
127127
var button = new MyButton();
128128
var labelgetIMAGE_ID_PROP = button.getIMAGE_ID_PROP();
129129
//
130-
130+
131131
var button2 = new com.tns.tests.Button1();
132132
var labelgetIMAGE_ID_PROP2 = button2.getIMAGE_ID_PROP();
133-
133+
134134
expect(labelgetIMAGE_ID_PROP1).toBe(labelgetIMAGE_ID_PROP2);
135135
});
136136

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
{
2+
"nativescript": {
3+
"recursive-static-bindings": true
4+
}
25
}

0 commit comments

Comments
 (0)