Skip to content

Commit 8c500ac

Browse files
Updated JavaScript test files.
1 parent e86fdda commit 8c500ac

10 files changed

Lines changed: 31 additions & 21 deletions

File tree

ClearScriptTest/JavaScript/CommonJS/Arithmetic/Arithmetic.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4-
exports.Meta = module.getContext();
4+
exports.Module = module;
5+
exports.Meta = module.meta;
56

67
exports.Add = function (a, b) {
78
return a + b;

ClearScriptTest/JavaScript/CommonJS/Geometry/Geometry.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
let Arithmetic = require("../Arithmetic/Arithmetic");
55
let Self = require("Geometry");
66

7-
exports.Meta = module.getContext();
7+
exports.Module = module;
8+
exports.Meta = module.meta;
89

910
exports.Rectangle = class {
1011
constructor(width, height) {

ClearScriptTest/JavaScript/CommonJS/Geometry/GeometryWithPathlessImport.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
let Arithmetic = require("Arithmetic");
55
let Self = require("Geometry");
66

7-
exports.Meta = module.getContext();
7+
exports.Module = module;
8+
exports.Meta = module.meta;
89

910
exports.Rectangle = class {
1011
constructor(width, height) {

ClearScriptTest/JavaScript/CommonJS/Module.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4+
// ReSharper disable once JsPathNotFound
45
let Geometry = require("Geometry/Geometry");
56

67
// ReSharper disable once ReturnFromGlobalScopetWithValue

ClearScriptTest/JavaScript/CommonJS/ModuleWithSideEffects.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4+
// ReSharper disable once JsPathNotFound
45
let Geometry = require("Geometry/Geometry");
56

67
foo.bar = new Geometry.Square(25).Area;

ClearScriptTest/JavaScript/LegacyCommonJS/Arithmetic/Arithmetic.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4+
exports.Module = module;
45
exports.Meta = module.getContext();
56

67
exports.Add = function (a, b) {

ClearScriptTest/JavaScript/LegacyCommonJS/Geometry/Geometry.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
var Arithmetic = require("../Arithmetic/Arithmetic");
55
var Self = require("Geometry");
66

7+
exports.Module = module;
78
exports.Meta = module.getContext();
89

9-
exports.Rectangle = function(width, height) {
10-
this.width = width;
11-
this.height = height;
10+
exports.Rectangle = function (width, height) {
11+
this.width = width;
12+
this.height = height;
1213
}
1314

14-
exports.Rectangle.prototype.getArea = function() {
15-
return Self.Rectangle.CalculateArea(this.width, this.height);
15+
exports.Rectangle.prototype.getArea = function () {
16+
return Self.Rectangle.CalculateArea(this.width, this.height);
1617
};
1718

18-
exports.Rectangle.CalculateArea = function(width, height) {
19-
return Arithmetic.Multiply(width, height);
19+
exports.Rectangle.CalculateArea = function (width, height) {
20+
return Arithmetic.Multiply(width, height);
2021
};
2122

22-
exports.Square = function(side) {
23-
exports.Rectangle.call(this, side, side);
23+
exports.Square = function (side) {
24+
exports.Rectangle.call(this, side, side);
2425
};
2526

2627
exports.Square.prototype.getArea = exports.Rectangle.prototype.getArea;

ClearScriptTest/JavaScript/LegacyCommonJS/Geometry/GeometryWithPathlessImport.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
var Arithmetic = require("Arithmetic");
55
var Self = require("Geometry");
66

7+
exports.Module = module;
78
exports.Meta = module.getContext();
89

910
exports.Rectangle = function (width, height) {
10-
this.width = width;
11-
this.height = height;
11+
this.width = width;
12+
this.height = height;
1213
}
1314

1415
exports.Rectangle.prototype.getArea = function () {
15-
return Self.Rectangle.CalculateArea(this.width, this.height);
16+
return Self.Rectangle.CalculateArea(this.width, this.height);
1617
};
1718

1819
exports.Rectangle.CalculateArea = function (width, height) {
19-
return Arithmetic.Multiply(width, height);
20+
return Arithmetic.Multiply(width, height);
2021
};
2122

2223
exports.Square = function (side) {
23-
exports.Rectangle.call(this, side, side);
24+
exports.Rectangle.call(this, side, side);
2425
};
2526

2627
exports.Square.prototype.getArea = exports.Rectangle.prototype.getArea;
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4-
let Geometry = require("Geometry/Geometry");
4+
// ReSharper disable once JsPathNotFound
5+
var Geometry = require("Geometry/Geometry");
56

67
// ReSharper disable once ReturnFromGlobalScopetWithValue
7-
return new Geometry.Square(25).Area;
8+
return new Geometry.Square(25).getArea();
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4-
let Geometry = require("Geometry/Geometry");
4+
// ReSharper disable once JsPathNotFound
5+
var Geometry = require("Geometry/Geometry");
56

6-
foo.bar = new Geometry.Square(25).Area;
7+
foo.bar = new Geometry.Square(25).getArea();
78

89
// ReSharper disable once ReturnFromGlobalScopetWithValue
910
return foo.bar;

0 commit comments

Comments
 (0)