diff --git a/gentest/gentest-javascript.js b/gentest/gentest-javascript.js index 051049ab..0c07de34 100644 --- a/gentest/gentest-javascript.js +++ b/gentest/gentest-javascript.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -var JavascriptEmitter = function() { +const JavascriptEmitter = function() { Emitter.call(this, 'js', ' '); }; @@ -17,9 +17,8 @@ function toValueJavascript(value) { } function toJavascriptUpper(symbol) { - var out = ''; - for (var i = 0; i < symbol.length; i++) { - var c = symbol[i]; + let out = ''; + for (const c of symbol) { if (c == c.toUpperCase() && i != 0 && symbol[i - 1] != symbol[i - 1].toUpperCase()) { out += '_'; } @@ -36,11 +35,11 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, { emitTestPrologue:{value:function(name, experiments) { this.push('it(' + JSON.stringify(name) + ', function () {'); this.pushIndent(); - this.push('var config = Yoga.Config.create();'); + this.push('const config = Yoga.Config.create();'); this.push(''); if (experiments.length > 0) { - for (var i in experiments) { + for (const i in experiments) { this.push('config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_' + toJavascriptUpper(experiments[i]) + ', true);'); } this.push(''); @@ -51,7 +50,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, { }}, emitTestTreePrologue:{value:function(nodeName) { - this.push('var ' + nodeName + ' = Yoga.Node.create(config);'); + this.push('const ' + nodeName + ' = Yoga.Node.create(config);'); }}, emitTestEpilogue:{value:function(experiments) { diff --git a/javascript/tests/YGAlignBaselineTest.test.js b/javascript/tests/YGAlignBaselineTest.test.js index 64d346b0..dd3e8a71 100644 --- a/javascript/tests/YGAlignBaselineTest.test.js +++ b/javascript/tests/YGAlignBaselineTest.test.js @@ -6,34 +6,34 @@ */ it("align_baseline_parent_using_child_in_column_as_reference", function () { - var config = Yoga.Config.create(); + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(1000); root.setHeight(1000); root.setAlignItems(Yoga.ALIGN_BASELINE); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child0.setWidth(500); root_child0.setHeight(600); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1.setWidth(500); root_child1.setHeight(800); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1_child0.setWidth(500); root_child1_child0.setHeight(300); root_child1.insertChild(root_child1_child0, 0); - var root_child1_child1 = Yoga.Node.create(config); + const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1_child1.setWidth(500); root_child1_child1.setHeight(400); @@ -80,34 +80,34 @@ it("align_baseline_parent_using_child_in_column_as_reference", function () { }); it("align_baseline_parent_using_child_in_row_as_reference", function () { - var config = Yoga.Config.create(); + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(1000); root.setHeight(1000); root.setAlignItems(Yoga.ALIGN_BASELINE); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child0.setWidth(500); root_child0.setHeight(600); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child1.setWidth(500); root_child1.setHeight(800); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1_child0.setWidth(500); root_child1_child0.setHeight(500); root_child1.insertChild(root_child1_child0, 0); - var root_child1_child1 = Yoga.Node.create(config); + const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN); root_child1_child1.setWidth(500); root_child1_child1.setHeight(400); diff --git a/javascript/tests/YGComputedBorderTest.test.js b/javascript/tests/YGComputedBorderTest.test.js index dc491aad..72dd4c5e 100644 --- a/javascript/tests/YGComputedBorderTest.test.js +++ b/javascript/tests/YGComputedBorderTest.test.js @@ -6,7 +6,7 @@ */ it("border_start", function () { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); root.setBorder(Yoga.EDGE_START, 10); diff --git a/javascript/tests/YGComputedMarginTest.test.js b/javascript/tests/YGComputedMarginTest.test.js index 9b89e9d7..7df2e981 100644 --- a/javascript/tests/YGComputedMarginTest.test.js +++ b/javascript/tests/YGComputedMarginTest.test.js @@ -6,7 +6,7 @@ */ it("margin_start", function () { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); root.setMargin(Yoga.EDGE_START, `10%`); diff --git a/javascript/tests/YGComputedPaddingTest.test.js b/javascript/tests/YGComputedPaddingTest.test.js index d9576450..0adb5061 100644 --- a/javascript/tests/YGComputedPaddingTest.test.js +++ b/javascript/tests/YGComputedPaddingTest.test.js @@ -6,7 +6,7 @@ */ it("padding_start", function () { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); root.setPadding(Yoga.EDGE_START, `10%`); diff --git a/javascript/tests/YGDirtiedTest.test.js b/javascript/tests/YGDirtiedTest.test.js index d6e201cf..7f8c6ced 100644 --- a/javascript/tests/YGDirtiedTest.test.js +++ b/javascript/tests/YGDirtiedTest.test.js @@ -6,7 +6,7 @@ */ it("dirtied", function() { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); @@ -36,19 +36,19 @@ it("dirtied", function() { }); it("dirtied_propagation", function() { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(); + const root_child0 = Yoga.Node.create(); root_child0.setAlignItems(Yoga.ALIGN_FLEX_START); root_child0.setWidth(50); root_child0.setHeight(20); root_child0.setMeasureFunc(function() {}); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(); + const root_child1 = Yoga.Node.create(); root_child1.setAlignItems(Yoga.ALIGN_FLEX_START); root_child1.setWidth(50); root_child1.setHeight(20); @@ -77,19 +77,19 @@ it("dirtied_propagation", function() { }); it("dirtied_hierarchy", function() { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(); + const root_child0 = Yoga.Node.create(); root_child0.setAlignItems(Yoga.ALIGN_FLEX_START); root_child0.setWidth(50); root_child0.setHeight(20); root_child0.setMeasureFunc(function() {}); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(); + const root_child1 = Yoga.Node.create(); root_child1.setAlignItems(Yoga.ALIGN_FLEX_START); root_child1.setWidth(50); root_child1.setHeight(20); @@ -124,7 +124,7 @@ it("dirtied_hierarchy", function() { }); it("dirtied_reset", function() { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); diff --git a/javascript/tests/YGMeasureCacheTest.test.js b/javascript/tests/YGMeasureCacheTest.test.js index 8b717f58..07c44a43 100644 --- a/javascript/tests/YGMeasureCacheTest.test.js +++ b/javascript/tests/YGMeasureCacheTest.test.js @@ -6,15 +6,15 @@ */ it("measure_once_single_flexible_child", function () { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); - var measureCounter = getMeasureCounterMax(Yoga); + const measureCounter = getMeasureCounterMax(Yoga); - var root_child0 = Yoga.Node.create(); + const root_child0 = Yoga.Node.create(); root_child0.setMeasureFunc(measureCounter.inc); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); diff --git a/javascript/tests/YGMeasureTest.test.js b/javascript/tests/YGMeasureTest.test.js index 69b02134..331b5ae5 100644 --- a/javascript/tests/YGMeasureTest.test.js +++ b/javascript/tests/YGMeasureTest.test.js @@ -6,13 +6,13 @@ */ it("dont_measure_single_grow_shrink_child", function () { - var root = Yoga.Node.create(); + const root = Yoga.Node.create(); root.setWidth(100); root.setHeight(100); - var measureCounter = getMeasureCounter(Yoga, null, 100, 100); + const measureCounter = getMeasureCounter(Yoga, null, 100, 100); - var root_child0 = Yoga.Node.create(); + const root_child0 = Yoga.Node.create(); root_child0.setMeasureFunc(measureCounter.inc); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); diff --git a/javascript/tests/generated/YGAbsolutePositionTest.test.js b/javascript/tests/generated/YGAbsolutePositionTest.test.js index ce400d29..fbe4bbdf 100644 --- a/javascript/tests/generated/YGAbsolutePositionTest.test.js +++ b/javascript/tests/generated/YGAbsolutePositionTest.test.js @@ -7,15 +7,15 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGAbsolutePositionTest.html -it("absolute_layout_width_height_start_top", function () { - var config = Yoga.Config.create(); +test("absolute_layout_width_height_start_top", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_START, 10); root_child0.setPosition(Yoga.EDGE_TOP, 10); @@ -24,27 +24,27 @@ it("absolute_layout_width_height_start_top", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -53,15 +53,15 @@ it("absolute_layout_width_height_start_top", function () { config.free(); } }); -it("absolute_layout_width_height_end_bottom", function () { - var config = Yoga.Config.create(); +test("absolute_layout_width_height_end_bottom", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_END, 10); root_child0.setPosition(Yoga.EDGE_BOTTOM, 10); @@ -70,27 +70,27 @@ it("absolute_layout_width_height_end_bottom", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(80); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(80); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -99,15 +99,15 @@ it("absolute_layout_width_height_end_bottom", function () { config.free(); } }); -it("absolute_layout_start_top_end_bottom", function () { - var config = Yoga.Config.create(); +test("absolute_layout_start_top_end_bottom", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_START, 10); root_child0.setPosition(Yoga.EDGE_TOP, 10); @@ -116,27 +116,27 @@ it("absolute_layout_start_top_end_bottom", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(80); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -145,15 +145,15 @@ it("absolute_layout_start_top_end_bottom", function () { config.free(); } }); -it("absolute_layout_width_height_start_top_end_bottom", function () { - var config = Yoga.Config.create(); +test("absolute_layout_width_height_start_top_end_bottom", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_START, 10); root_child0.setPosition(Yoga.EDGE_TOP, 10); @@ -164,27 +164,27 @@ it("absolute_layout_width_height_start_top_end_bottom", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -193,59 +193,59 @@ it("absolute_layout_width_height_start_top_end_bottom", function () { config.free(); } }); -it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent", function () { - var config = Yoga.Config.create(); +test("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setOverflow(Yoga.OVERFLOW_HIDDEN); root.setWidth(50); root.setHeight(50); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_START, 0); root_child0.setPosition(Yoga.EDGE_TOP, 0); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(100); root_child0_child0.setHeight(100); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); + expect(root.getComputedHeight()).toBe(50); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); + expect(root.getComputedHeight()).toBe(50); - console.assert(-50 === root_child0.getComputedLeft(), "-50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -254,11 +254,11 @@ it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent config.free(); } }); -it("absolute_layout_within_border", function () { - var config = Yoga.Config.create(); +test("absolute_layout_within_border", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setMargin(Yoga.EDGE_LEFT, 10); root.setMargin(Yoga.EDGE_TOP, 10); root.setMargin(Yoga.EDGE_RIGHT, 10); @@ -274,7 +274,7 @@ it("absolute_layout_within_border", function () { root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_LEFT, 0); root_child0.setPosition(Yoga.EDGE_TOP, 0); @@ -282,7 +282,7 @@ it("absolute_layout_within_border", function () { root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child1.setPosition(Yoga.EDGE_RIGHT, 0); root_child1.setPosition(Yoga.EDGE_BOTTOM, 0); @@ -290,7 +290,7 @@ it("absolute_layout_within_border", function () { root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child2.setPosition(Yoga.EDGE_LEFT, 0); root_child2.setPosition(Yoga.EDGE_TOP, 0); @@ -302,7 +302,7 @@ it("absolute_layout_within_border", function () { root_child2.setHeight(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child3.setPosition(Yoga.EDGE_RIGHT, 0); root_child3.setPosition(Yoga.EDGE_BOTTOM, 0); @@ -315,57 +315,57 @@ it("absolute_layout_within_border", function () { root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(10 === root.getComputedLeft(), "10 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(10 === root.getComputedTop(), "10 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(10); + expect(root.getComputedTop()).toBe(10); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(30); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(10 === root.getComputedLeft(), "10 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(10 === root.getComputedTop(), "10 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(10); + expect(root.getComputedTop()).toBe(10); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(30); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -374,45 +374,45 @@ it("absolute_layout_within_border", function () { config.free(); } }); -it("absolute_layout_align_items_and_justify_content_center", function () { - var config = Yoga.Config.create(); +test("absolute_layout_align_items_and_justify_content_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(60); root_child0.setHeight(40); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -421,45 +421,45 @@ it("absolute_layout_align_items_and_justify_content_center", function () { config.free(); } }); -it("absolute_layout_align_items_and_justify_content_flex_end", function () { - var config = Yoga.Config.create(); +test("absolute_layout_align_items_and_justify_content_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setAlignItems(Yoga.ALIGN_FLEX_END); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(60); root_child0.setHeight(40); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(60 === root_child0.getComputedTop(), "60 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(60); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(60 === root_child0.getComputedTop(), "60 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(60); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -468,44 +468,44 @@ it("absolute_layout_align_items_and_justify_content_flex_end", function () { config.free(); } }); -it("absolute_layout_justify_content_center", function () { - var config = Yoga.Config.create(); +test("absolute_layout_justify_content_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(60); root_child0.setHeight(40); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -514,44 +514,44 @@ it("absolute_layout_justify_content_center", function () { config.free(); } }); -it("absolute_layout_align_items_center", function () { - var config = Yoga.Config.create(); +test("absolute_layout_align_items_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(60); root_child0.setHeight(40); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -560,16 +560,16 @@ it("absolute_layout_align_items_center", function () { config.free(); } }); -it("absolute_layout_align_items_center_on_child_only", function () { - var config = Yoga.Config.create(); +test("absolute_layout_align_items_center_on_child_only", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignSelf(Yoga.ALIGN_CENTER); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(60); @@ -577,27 +577,27 @@ it("absolute_layout_align_items_center_on_child_only", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -606,18 +606,18 @@ it("absolute_layout_align_items_center_on_child_only", function () { config.free(); } }); -it("absolute_layout_align_items_and_justify_content_center_and_top_position", function () { - var config = Yoga.Config.create(); +test("absolute_layout_align_items_and_justify_content_center_and_top_position", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_TOP, 10); root_child0.setWidth(60); @@ -625,27 +625,27 @@ it("absolute_layout_align_items_and_justify_content_center_and_top_position", fu root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -654,18 +654,18 @@ it("absolute_layout_align_items_and_justify_content_center_and_top_position", fu config.free(); } }); -it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", function () { - var config = Yoga.Config.create(); +test("absolute_layout_align_items_and_justify_content_center_and_bottom_position", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_BOTTOM, 10); root_child0.setWidth(60); @@ -673,27 +673,27 @@ it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(50); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(50); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -702,18 +702,18 @@ it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", config.free(); } }); -it("absolute_layout_align_items_and_justify_content_center_and_left_position", function () { - var config = Yoga.Config.create(); +test("absolute_layout_align_items_and_justify_content_center_and_left_position", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_LEFT, 5); root_child0.setWidth(60); @@ -721,27 +721,27 @@ it("absolute_layout_align_items_and_justify_content_center_and_left_position", f root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(5); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(5); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -750,18 +750,18 @@ it("absolute_layout_align_items_and_justify_content_center_and_left_position", f config.free(); } }); -it("absolute_layout_align_items_and_justify_content_center_and_right_position", function () { - var config = Yoga.Config.create(); +test("absolute_layout_align_items_and_justify_content_center_and_right_position", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setFlexGrow(1); root.setWidth(110); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_RIGHT, 5); root_child0.setWidth(60); @@ -769,27 +769,27 @@ it("absolute_layout_align_items_and_justify_content_center_and_right_position", root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(110 === root.getComputedWidth(), "110 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(110); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -798,27 +798,27 @@ it("absolute_layout_align_items_and_justify_content_center_and_right_position", config.free(); } }); -it("position_root_with_rtl_should_position_withoutdirection", function () { - var config = Yoga.Config.create(); +test("position_root_with_rtl_should_position_withoutdirection", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setPosition(Yoga.EDGE_LEFT, 72); root.setWidth(52); root.setHeight(52); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(72 === root.getComputedLeft(), "72 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(72); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(72 === root.getComputedLeft(), "72 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(72); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -827,29 +827,29 @@ it("position_root_with_rtl_should_position_withoutdirection", function () { config.free(); } }); -it("absolute_layout_percentage_bottom_based_on_parent_height", function () { - var config = Yoga.Config.create(); +test("absolute_layout_percentage_bottom_based_on_parent_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_TOP, "50%"); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child1.setPosition(Yoga.EDGE_BOTTOM, "50%"); root_child1.setWidth(10); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child2.setPosition(Yoga.EDGE_TOP, "10%"); root_child2.setPosition(Yoga.EDGE_BOTTOM, "10%"); @@ -857,47 +857,47 @@ it("absolute_layout_percentage_bottom_based_on_parent_height", function () { root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(100 === root_child0.getComputedTop(), "100 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(90 === root_child1.getComputedTop(), "90 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(90); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(160 === root_child2.getComputedHeight(), "160 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(160); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(100 === root_child0.getComputedTop(), "100 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(90 === root_child1.getComputedLeft(), "90 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(90 === root_child1.getComputedTop(), "90 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(90); + expect(root_child1.getComputedTop()).toBe(90); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(90 === root_child2.getComputedLeft(), "90 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(160 === root_child2.getComputedHeight(), "160 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(90); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(160); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -906,43 +906,43 @@ it("absolute_layout_percentage_bottom_based_on_parent_height", function () { config.free(); } }); -it("absolute_layout_in_wrap_reverse_column_container", function () { - var config = Yoga.Config.create(); +test("absolute_layout_in_wrap_reverse_column_container", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -951,44 +951,44 @@ it("absolute_layout_in_wrap_reverse_column_container", function () { config.free(); } }); -it("absolute_layout_in_wrap_reverse_row_container", function () { - var config = Yoga.Config.create(); +test("absolute_layout_in_wrap_reverse_row_container", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(80); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(80); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -997,16 +997,16 @@ it("absolute_layout_in_wrap_reverse_row_container", function () { config.free(); } }); -it("absolute_layout_in_wrap_reverse_column_container_flex_end", function () { - var config = Yoga.Config.create(); +test("absolute_layout_in_wrap_reverse_column_container_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignSelf(Yoga.ALIGN_FLEX_END); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(20); @@ -1014,27 +1014,27 @@ it("absolute_layout_in_wrap_reverse_column_container_flex_end", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1043,17 +1043,17 @@ it("absolute_layout_in_wrap_reverse_column_container_flex_end", function () { config.free(); } }); -it("absolute_layout_in_wrap_reverse_row_container_flex_end", function () { - var config = Yoga.Config.create(); +test("absolute_layout_in_wrap_reverse_row_container_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignSelf(Yoga.ALIGN_FLEX_END); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(20); @@ -1061,27 +1061,27 @@ it("absolute_layout_in_wrap_reverse_row_container_flex_end", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGAlignContentTest.test.js b/javascript/tests/generated/YGAlignContentTest.test.js index 74afca92..8e1802c7 100644 --- a/javascript/tests/generated/YGAlignContentTest.test.js +++ b/javascript/tests/generated/YGAlignContentTest.test.js @@ -7,103 +7,103 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGAlignContentTest.html -it("align_content_flex_start", function () { - var config = Yoga.Config.create(); +test("align_content_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(130); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(130); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(10 === root_child2.getComputedTop(), "10 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(10); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(10); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(20 === root_child4.getComputedTop(), "20 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(20); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(130); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(10 === root_child2.getComputedTop(), "10 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(80); + expect(root_child2.getComputedTop()).toBe(10); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(10); - console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(30); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(80 === root_child4.getComputedLeft(), "80 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(20 === root_child4.getComputedTop(), "20 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(80); + expect(root_child4.getComputedTop()).toBe(20); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -112,99 +112,99 @@ it("align_content_flex_start", function () { config.free(); } }); -it("align_content_flex_start_without_height_on_children", function () { - var config = Yoga.Config.create(); +test("align_content_flex_start_without_height_on_children", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(10 === root_child2.getComputedTop(), "10 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(10); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(0); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(20 === root_child4.getComputedTop(), "20 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(20); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(10 === root_child2.getComputedTop(), "10 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(10); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(0); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(20 === root_child4.getComputedTop(), "20 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(20); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -213,105 +213,105 @@ it("align_content_flex_start_without_height_on_children", function () { config.free(); } }); -it("align_content_flex_start_with_flex", function () { - var config = Yoga.Config.create(); +test("align_content_flex_start_with_flex", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(120); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("0%"); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexBasis("0%"); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setFlexGrow(1); root_child3.setFlexShrink(1); root_child3.setFlexBasis("0%"); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(120 === root.getComputedHeight(), "120 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(120); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(40); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(40); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(80); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(0); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(80); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(120 === root_child4.getComputedTop(), "120 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(120); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(120 === root.getComputedHeight(), "120 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(120); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(40); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(40); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(80); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(0); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(80); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(120 === root_child4.getComputedTop(), "120 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(120); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -320,103 +320,103 @@ it("align_content_flex_start_with_flex", function () { config.free(); } }); -it("align_content_flex_end", function () { - var config = Yoga.Config.create(); +test("align_content_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_FLEX_END); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(10); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(40); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(10); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(40); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -425,98 +425,98 @@ it("align_content_flex_end", function () { config.free(); } }); -it("align_content_stretch", function () { - var config = Yoga.Config.create(); +test("align_content_stretch", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(0); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(0 === root_child3.getComputedHeight(), "0 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(0); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(100 === root_child1.getComputedLeft(), "100 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(100); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(100); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(0); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(0 === root_child3.getComputedHeight(), "0 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(0); - console.assert(100 === root_child4.getComputedLeft(), "100 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(100); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -525,104 +525,104 @@ it("align_content_stretch", function () { config.free(); } }); -it("align_content_spacebetween", function () { - var config = Yoga.Config.create(); +test("align_content_spacebetween", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_SPACE_BETWEEN); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(130); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(130); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(45 === root_child2.getComputedTop(), "45 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(45); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(10); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(45 === root_child3.getComputedTop(), "45 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(45); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(90 === root_child4.getComputedTop(), "90 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(90); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(130 === root.getComputedWidth(), "130 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(130); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(45 === root_child2.getComputedTop(), "45 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(80); + expect(root_child2.getComputedTop()).toBe(45); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(10); - console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(45 === root_child3.getComputedTop(), "45 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(30); + expect(root_child3.getComputedTop()).toBe(45); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(80 === root_child4.getComputedLeft(), "80 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(90 === root_child4.getComputedTop(), "90 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(80); + expect(root_child4.getComputedTop()).toBe(90); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -631,104 +631,104 @@ it("align_content_spacebetween", function () { config.free(); } }); -it("align_content_spacearound", function () { - var config = Yoga.Config.create(); +test("align_content_spacearound", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_SPACE_AROUND); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(140); root.setHeight(120); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(10); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(10); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root_child4.setHeight(10); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(140 === root.getComputedWidth(), "140 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(120 === root.getComputedHeight(), "120 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(140); + expect(root.getComputedHeight()).toBe(120); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(15 === root_child0.getComputedTop(), "15 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(15); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(15 === root_child1.getComputedTop(), "15 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(15); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(55 === root_child2.getComputedTop(), "55 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(55); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(10); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(55 === root_child3.getComputedTop(), "55 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(55); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(95 === root_child4.getComputedTop(), "95 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(95); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(140 === root.getComputedWidth(), "140 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(120 === root.getComputedHeight(), "120 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(140); + expect(root.getComputedHeight()).toBe(120); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(15 === root_child0.getComputedTop(), "15 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(15); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(15 === root_child1.getComputedTop(), "15 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(15); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(90 === root_child2.getComputedLeft(), "90 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(55 === root_child2.getComputedTop(), "55 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(90); + expect(root_child2.getComputedTop()).toBe(55); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(10); - console.assert(40 === root_child3.getComputedLeft(), "40 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(55 === root_child3.getComputedTop(), "55 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(40); + expect(root_child3.getComputedTop()).toBe(55); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(90 === root_child4.getComputedLeft(), "90 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(95 === root_child4.getComputedTop(), "95 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(90); + expect(root_child4.getComputedTop()).toBe(95); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -737,99 +737,99 @@ it("align_content_spacearound", function () { config.free(); } }); -it("align_content_stretch_row", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(100); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(50 === root_child4.getComputedTop(), "50 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(50); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(50 === root_child4.getComputedTop(), "50 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(50); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -838,115 +838,115 @@ it("align_content_stretch_row", function () { config.free(); } }); -it("align_content_stretch_row_with_children", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_children", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0.insertChild(root_child0_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0.getComputedWidth(), "50 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(100); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(50 === root_child4.getComputedTop(), "50 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(50); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0.getComputedWidth(), "50 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(50 === root_child4.getComputedTop(), "50 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(50); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -955,105 +955,105 @@ it("align_content_stretch_row_with_children", function () { config.free(); } }); -it("align_content_stretch_row_with_flex", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_flex", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root_child1.setWidth(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setFlexGrow(1); root_child3.setFlexShrink(1); root_child3.setFlexBasis("0%"); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(100); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(0 === root_child3.getComputedWidth(), "0 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(100 === root_child3.getComputedHeight(), "100 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(0); + expect(root_child3.getComputedHeight()).toBe(100); - console.assert(100 === root_child4.getComputedLeft(), "100 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(100); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(100 === root_child1.getComputedLeft(), "100 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(100); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(100); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(0 === root_child3.getComputedWidth(), "0 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(100 === root_child3.getComputedHeight(), "100 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(0); + expect(root_child3.getComputedHeight()).toBe(100); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1062,104 +1062,104 @@ it("align_content_stretch_row_with_flex", function () { config.free(); } }); -it("align_content_stretch_row_with_flex_no_shrink", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_flex_no_shrink", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root_child1.setWidth(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setFlexGrow(1); root_child3.setFlexBasis("0%"); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(100); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(0 === root_child3.getComputedWidth(), "0 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(100 === root_child3.getComputedHeight(), "100 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(0); + expect(root_child3.getComputedHeight()).toBe(100); - console.assert(100 === root_child4.getComputedLeft(), "100 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(100); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(100 === root_child1.getComputedLeft(), "100 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(100); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(100); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(0 === root_child3.getComputedWidth(), "0 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(100 === root_child3.getComputedHeight(), "100 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(0); + expect(root_child3.getComputedHeight()).toBe(100); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1168,22 +1168,22 @@ it("align_content_stretch_row_with_flex_no_shrink", function () { config.free(); } }); -it("align_content_stretch_row_with_margin", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_margin", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setMargin(Yoga.EDGE_LEFT, 10); root_child1.setMargin(Yoga.EDGE_TOP, 10); root_child1.setMargin(Yoga.EDGE_RIGHT, 10); @@ -1191,11 +1191,11 @@ it("align_content_stretch_row_with_margin", function () { root_child1.setWidth(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setMargin(Yoga.EDGE_LEFT, 10); root_child3.setMargin(Yoga.EDGE_TOP, 10); root_child3.setMargin(Yoga.EDGE_RIGHT, 10); @@ -1203,72 +1203,72 @@ it("align_content_stretch_row_with_margin", function () { root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(40); - console.assert(60 === root_child1.getComputedLeft(), "60 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(60); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(40 === root_child2.getComputedTop(), "40 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(40 === root_child2.getComputedHeight(), "40 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(40); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(40); - console.assert(60 === root_child3.getComputedLeft(), "60 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(60); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(80 === root_child4.getComputedTop(), "80 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(80); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0.getComputedHeight(), "40 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(40); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(40 === root_child2.getComputedTop(), "40 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(40 === root_child2.getComputedHeight(), "40 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(100); + expect(root_child2.getComputedTop()).toBe(40); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(40); - console.assert(40 === root_child3.getComputedLeft(), "40 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(40); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(100 === root_child4.getComputedLeft(), "100 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(80 === root_child4.getComputedTop(), "80 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(100); + expect(root_child4.getComputedTop()).toBe(80); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1277,22 +1277,22 @@ it("align_content_stretch_row_with_margin", function () { config.free(); } }); -it("align_content_stretch_row_with_padding", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_padding", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setPadding(Yoga.EDGE_LEFT, 10); root_child1.setPadding(Yoga.EDGE_TOP, 10); root_child1.setPadding(Yoga.EDGE_RIGHT, 10); @@ -1300,11 +1300,11 @@ it("align_content_stretch_row_with_padding", function () { root_child1.setWidth(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setPadding(Yoga.EDGE_LEFT, 10); root_child3.setPadding(Yoga.EDGE_TOP, 10); root_child3.setPadding(Yoga.EDGE_RIGHT, 10); @@ -1312,72 +1312,72 @@ it("align_content_stretch_row_with_padding", function () { root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(100); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(50 === root_child4.getComputedTop(), "50 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(50); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(50 === root_child4.getComputedTop(), "50 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(50); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1386,57 +1386,57 @@ it("align_content_stretch_row_with_padding", function () { config.free(); } }); -it("align_content_stretch_row_with_single_row", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_single_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1445,100 +1445,100 @@ it("align_content_stretch_row_with_single_row", function () { config.free(); } }); -it("align_content_stretch_row_with_fixed_height", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_fixed_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(60); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(80); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(60 === root_child1.getComputedHeight(), "60 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(60); - console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(80 === root_child2.getComputedHeight(), "80 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(100); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(80); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(80); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(80 === root_child4.getComputedTop(), "80 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(80); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(80); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(60 === root_child1.getComputedHeight(), "60 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(60); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(80 === root_child2.getComputedHeight(), "80 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(80); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(80); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(80 === root_child4.getComputedTop(), "80 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(80); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1547,100 +1547,100 @@ it("align_content_stretch_row_with_fixed_height", function () { config.free(); } }); -it("align_content_stretch_row_with_max_height", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_max_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setMaxHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(100); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(50 === root_child4.getComputedTop(), "50 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(50); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(50 === root_child3.getComputedTop(), "50 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(50); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(50 === root_child4.getComputedTop(), "50 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(50); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1649,100 +1649,100 @@ it("align_content_stretch_row_with_max_height", function () { config.free(); } }); -it("align_content_stretch_row_with_min_height", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_row_with_min_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setMinHeight(80); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(90 === root_child0.getComputedHeight(), "90 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(90 === root_child1.getComputedHeight(), "90 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(90); - console.assert(100 === root_child2.getComputedLeft(), "100 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(90 === root_child2.getComputedHeight(), "90 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(100); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(90); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(90 === root_child3.getComputedTop(), "90 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(90); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(90 === root_child4.getComputedTop(), "90 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(90); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(90 === root_child0.getComputedHeight(), "90 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(90); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(90 === root_child1.getComputedHeight(), "90 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(90); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(90 === root_child2.getComputedHeight(), "90 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(90); - console.assert(100 === root_child3.getComputedLeft(), "100 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(90 === root_child3.getComputedTop(), "90 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(10 === root_child3.getComputedHeight(), "10 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(100); + expect(root_child3.getComputedTop()).toBe(90); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(10); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(90 === root_child4.getComputedTop(), "90 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(10 === root_child4.getComputedHeight(), "10 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(90); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1751,117 +1751,117 @@ it("align_content_stretch_row_with_min_height", function () { config.free(); } }); -it("align_content_stretch_column", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(150); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis("0%"); root_child0.insertChild(root_child0_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(50); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setHeight(50); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setHeight(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(150 === root.getComputedHeight(), "150 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(150); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0.getComputedWidth(), "50 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(100 === root_child3.getComputedTop(), "100 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(100); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(150 === root.getComputedHeight(), "150 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(150); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0.getComputedWidth(), "50 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(100 === root_child3.getComputedTop(), "100 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(100); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(50 === root_child4.getComputedWidth(), "50 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(50); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1870,14 +1870,14 @@ it("align_content_stretch_column", function () { config.free(); } }); -it("align_content_stretch_is_not_overriding_align_items", function () { - var config = Yoga.Config.create(); +test("align_content_stretch_is_not_overriding_align_items", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0.setAlignItems(Yoga.ALIGN_CENTER); @@ -1885,44 +1885,44 @@ it("align_content_stretch_is_not_overriding_align_items", function () { root_child0.setHeight(100); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(45 === root_child0_child0.getComputedTop(), "45 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(45); + expect(root_child0_child0.getComputedWidth()).toBe(10); + expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(90 === root_child0_child0.getComputedLeft(), "90 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(45 === root_child0_child0.getComputedTop(), "45 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(90); + expect(root_child0_child0.getComputedTop()).toBe(45); + expect(root_child0_child0.getComputedWidth()).toBe(10); + expect(root_child0_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGAlignItemsTest.test.js b/javascript/tests/generated/YGAlignItemsTest.test.js index 8f92afec..02ee9df6 100644 --- a/javascript/tests/generated/YGAlignItemsTest.test.js +++ b/javascript/tests/generated/YGAlignItemsTest.test.js @@ -7,40 +7,40 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGAlignItemsTest.html -it("align_items_stretch", function () { - var config = Yoga.Config.create(); +test("align_items_stretch", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -49,42 +49,42 @@ it("align_items_stretch", function () { config.free(); } }); -it("align_items_center", function () { - var config = Yoga.Config.create(); +test("align_items_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -93,42 +93,42 @@ it("align_items_center", function () { config.free(); } }); -it("align_items_flex_start", function () { - var config = Yoga.Config.create(); +test("align_items_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -137,42 +137,42 @@ it("align_items_flex_start", function () { config.free(); } }); -it("align_items_flex_end", function () { - var config = Yoga.Config.create(); +test("align_items_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_END); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -181,58 +181,58 @@ it("align_items_flex_end", function () { config.free(); } }); -it("align_baseline", function () { - var config = Yoga.Config.create(); +test("align_baseline", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(30); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(30); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -241,73 +241,73 @@ it("align_baseline", function () { config.free(); } }); -it("align_baseline_child", function () { - var config = Yoga.Config.create(); +test("align_baseline_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -316,120 +316,120 @@ it("align_baseline_child", function () { config.free(); } }); -it("align_baseline_child_multiline", function () { - var config = Yoga.Config.create(); +test("align_baseline_child_multiline", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(60); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child1.setFlexWrap(Yoga.WRAP_WRAP); root_child1.setWidth(50); root_child1.setHeight(25); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(25); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); - var root_child1_child1 = Yoga.Node.create(config); + const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setWidth(25); root_child1_child1.setHeight(10); root_child1.insertChild(root_child1_child1, 1); - var root_child1_child2 = Yoga.Node.create(config); + const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setWidth(25); root_child1_child2.setHeight(20); root_child1.insertChild(root_child1_child2, 2); - var root_child1_child3 = Yoga.Node.create(config); + const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setWidth(25); root_child1_child3.setHeight(10); root_child1.insertChild(root_child1_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(25 === root_child1_child0.getComputedWidth(), "25 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(25); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(25 === root_child1_child1.getComputedLeft(), "25 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1_child1.getComputedTop(), "0 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")"); - console.assert(25 === root_child1_child1.getComputedWidth(), "25 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1_child1.getComputedHeight(), "10 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")"); + expect(root_child1_child1.getComputedLeft()).toBe(25); + expect(root_child1_child1.getComputedTop()).toBe(0); + expect(root_child1_child1.getComputedWidth()).toBe(25); + expect(root_child1_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")"); - console.assert(20 === root_child1_child2.getComputedTop(), "20 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")"); - console.assert(25 === root_child1_child2.getComputedWidth(), "25 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")"); - console.assert(20 === root_child1_child2.getComputedHeight(), "20 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")"); + expect(root_child1_child2.getComputedLeft()).toBe(0); + expect(root_child1_child2.getComputedTop()).toBe(20); + expect(root_child1_child2.getComputedWidth()).toBe(25); + expect(root_child1_child2.getComputedHeight()).toBe(20); - console.assert(25 === root_child1_child3.getComputedLeft(), "25 === root_child1_child3.getComputedLeft() (" + root_child1_child3.getComputedLeft() + ")"); - console.assert(20 === root_child1_child3.getComputedTop(), "20 === root_child1_child3.getComputedTop() (" + root_child1_child3.getComputedTop() + ")"); - console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); - console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); + expect(root_child1_child3.getComputedLeft()).toBe(25); + expect(root_child1_child3.getComputedTop()).toBe(20); + expect(root_child1_child3.getComputedWidth()).toBe(25); + expect(root_child1_child3.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(25 === root_child1_child0.getComputedLeft(), "25 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(25 === root_child1_child0.getComputedWidth(), "25 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(25); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(25); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1_child1.getComputedTop(), "0 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")"); - console.assert(25 === root_child1_child1.getComputedWidth(), "25 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1_child1.getComputedHeight(), "10 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")"); + expect(root_child1_child1.getComputedLeft()).toBe(0); + expect(root_child1_child1.getComputedTop()).toBe(0); + expect(root_child1_child1.getComputedWidth()).toBe(25); + expect(root_child1_child1.getComputedHeight()).toBe(10); - console.assert(25 === root_child1_child2.getComputedLeft(), "25 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")"); - console.assert(20 === root_child1_child2.getComputedTop(), "20 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")"); - console.assert(25 === root_child1_child2.getComputedWidth(), "25 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")"); - console.assert(20 === root_child1_child2.getComputedHeight(), "20 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")"); + expect(root_child1_child2.getComputedLeft()).toBe(25); + expect(root_child1_child2.getComputedTop()).toBe(20); + expect(root_child1_child2.getComputedWidth()).toBe(25); + expect(root_child1_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child3.getComputedLeft(), "0 === root_child1_child3.getComputedLeft() (" + root_child1_child3.getComputedLeft() + ")"); - console.assert(20 === root_child1_child3.getComputedTop(), "20 === root_child1_child3.getComputedTop() (" + root_child1_child3.getComputedTop() + ")"); - console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); - console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); + expect(root_child1_child3.getComputedLeft()).toBe(0); + expect(root_child1_child3.getComputedTop()).toBe(20); + expect(root_child1_child3.getComputedWidth()).toBe(25); + expect(root_child1_child3.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -438,122 +438,122 @@ it("align_baseline_child_multiline", function () { config.free(); } }); -it("align_baseline_child_multiline_override", function () { - var config = Yoga.Config.create(); +test("align_baseline_child_multiline_override", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(60); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child1.setFlexWrap(Yoga.WRAP_WRAP); root_child1.setWidth(50); root_child1.setHeight(25); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(25); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); - var root_child1_child1 = Yoga.Node.create(config); + const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setAlignSelf(Yoga.ALIGN_BASELINE); root_child1_child1.setWidth(25); root_child1_child1.setHeight(10); root_child1.insertChild(root_child1_child1, 1); - var root_child1_child2 = Yoga.Node.create(config); + const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setWidth(25); root_child1_child2.setHeight(20); root_child1.insertChild(root_child1_child2, 2); - var root_child1_child3 = Yoga.Node.create(config); + const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setAlignSelf(Yoga.ALIGN_BASELINE); root_child1_child3.setWidth(25); root_child1_child3.setHeight(10); root_child1.insertChild(root_child1_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(25 === root_child1_child0.getComputedWidth(), "25 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(25); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(25 === root_child1_child1.getComputedLeft(), "25 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1_child1.getComputedTop(), "0 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")"); - console.assert(25 === root_child1_child1.getComputedWidth(), "25 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1_child1.getComputedHeight(), "10 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")"); + expect(root_child1_child1.getComputedLeft()).toBe(25); + expect(root_child1_child1.getComputedTop()).toBe(0); + expect(root_child1_child1.getComputedWidth()).toBe(25); + expect(root_child1_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")"); - console.assert(20 === root_child1_child2.getComputedTop(), "20 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")"); - console.assert(25 === root_child1_child2.getComputedWidth(), "25 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")"); - console.assert(20 === root_child1_child2.getComputedHeight(), "20 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")"); + expect(root_child1_child2.getComputedLeft()).toBe(0); + expect(root_child1_child2.getComputedTop()).toBe(20); + expect(root_child1_child2.getComputedWidth()).toBe(25); + expect(root_child1_child2.getComputedHeight()).toBe(20); - console.assert(25 === root_child1_child3.getComputedLeft(), "25 === root_child1_child3.getComputedLeft() (" + root_child1_child3.getComputedLeft() + ")"); - console.assert(20 === root_child1_child3.getComputedTop(), "20 === root_child1_child3.getComputedTop() (" + root_child1_child3.getComputedTop() + ")"); - console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); - console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); + expect(root_child1_child3.getComputedLeft()).toBe(25); + expect(root_child1_child3.getComputedTop()).toBe(20); + expect(root_child1_child3.getComputedWidth()).toBe(25); + expect(root_child1_child3.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(25 === root_child1_child0.getComputedLeft(), "25 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(25 === root_child1_child0.getComputedWidth(), "25 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(25); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(25); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1_child1.getComputedTop(), "0 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")"); - console.assert(25 === root_child1_child1.getComputedWidth(), "25 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1_child1.getComputedHeight(), "10 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")"); + expect(root_child1_child1.getComputedLeft()).toBe(0); + expect(root_child1_child1.getComputedTop()).toBe(0); + expect(root_child1_child1.getComputedWidth()).toBe(25); + expect(root_child1_child1.getComputedHeight()).toBe(10); - console.assert(25 === root_child1_child2.getComputedLeft(), "25 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")"); - console.assert(20 === root_child1_child2.getComputedTop(), "20 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")"); - console.assert(25 === root_child1_child2.getComputedWidth(), "25 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")"); - console.assert(20 === root_child1_child2.getComputedHeight(), "20 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")"); + expect(root_child1_child2.getComputedLeft()).toBe(25); + expect(root_child1_child2.getComputedTop()).toBe(20); + expect(root_child1_child2.getComputedWidth()).toBe(25); + expect(root_child1_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child3.getComputedLeft(), "0 === root_child1_child3.getComputedLeft() (" + root_child1_child3.getComputedLeft() + ")"); - console.assert(20 === root_child1_child3.getComputedTop(), "20 === root_child1_child3.getComputedTop() (" + root_child1_child3.getComputedTop() + ")"); - console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); - console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); + expect(root_child1_child3.getComputedLeft()).toBe(0); + expect(root_child1_child3.getComputedTop()).toBe(20); + expect(root_child1_child3.getComputedWidth()).toBe(25); + expect(root_child1_child3.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -562,121 +562,121 @@ it("align_baseline_child_multiline_override", function () { config.free(); } }); -it("align_baseline_child_multiline_no_override_on_secondline", function () { - var config = Yoga.Config.create(); +test("align_baseline_child_multiline_no_override_on_secondline", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(60); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child1.setFlexWrap(Yoga.WRAP_WRAP); root_child1.setWidth(50); root_child1.setHeight(25); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(25); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); - var root_child1_child1 = Yoga.Node.create(config); + const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setWidth(25); root_child1_child1.setHeight(10); root_child1.insertChild(root_child1_child1, 1); - var root_child1_child2 = Yoga.Node.create(config); + const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setWidth(25); root_child1_child2.setHeight(20); root_child1.insertChild(root_child1_child2, 2); - var root_child1_child3 = Yoga.Node.create(config); + const root_child1_child3 = Yoga.Node.create(config); root_child1_child3.setAlignSelf(Yoga.ALIGN_BASELINE); root_child1_child3.setWidth(25); root_child1_child3.setHeight(10); root_child1.insertChild(root_child1_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(25 === root_child1_child0.getComputedWidth(), "25 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(25); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(25 === root_child1_child1.getComputedLeft(), "25 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1_child1.getComputedTop(), "0 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")"); - console.assert(25 === root_child1_child1.getComputedWidth(), "25 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1_child1.getComputedHeight(), "10 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")"); + expect(root_child1_child1.getComputedLeft()).toBe(25); + expect(root_child1_child1.getComputedTop()).toBe(0); + expect(root_child1_child1.getComputedWidth()).toBe(25); + expect(root_child1_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")"); - console.assert(20 === root_child1_child2.getComputedTop(), "20 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")"); - console.assert(25 === root_child1_child2.getComputedWidth(), "25 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")"); - console.assert(20 === root_child1_child2.getComputedHeight(), "20 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")"); + expect(root_child1_child2.getComputedLeft()).toBe(0); + expect(root_child1_child2.getComputedTop()).toBe(20); + expect(root_child1_child2.getComputedWidth()).toBe(25); + expect(root_child1_child2.getComputedHeight()).toBe(20); - console.assert(25 === root_child1_child3.getComputedLeft(), "25 === root_child1_child3.getComputedLeft() (" + root_child1_child3.getComputedLeft() + ")"); - console.assert(20 === root_child1_child3.getComputedTop(), "20 === root_child1_child3.getComputedTop() (" + root_child1_child3.getComputedTop() + ")"); - console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); - console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); + expect(root_child1_child3.getComputedLeft()).toBe(25); + expect(root_child1_child3.getComputedTop()).toBe(20); + expect(root_child1_child3.getComputedWidth()).toBe(25); + expect(root_child1_child3.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(25 === root_child1_child0.getComputedLeft(), "25 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(25 === root_child1_child0.getComputedWidth(), "25 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(25); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(25); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1_child1.getComputedTop(), "0 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")"); - console.assert(25 === root_child1_child1.getComputedWidth(), "25 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1_child1.getComputedHeight(), "10 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")"); + expect(root_child1_child1.getComputedLeft()).toBe(0); + expect(root_child1_child1.getComputedTop()).toBe(0); + expect(root_child1_child1.getComputedWidth()).toBe(25); + expect(root_child1_child1.getComputedHeight()).toBe(10); - console.assert(25 === root_child1_child2.getComputedLeft(), "25 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")"); - console.assert(20 === root_child1_child2.getComputedTop(), "20 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")"); - console.assert(25 === root_child1_child2.getComputedWidth(), "25 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")"); - console.assert(20 === root_child1_child2.getComputedHeight(), "20 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")"); + expect(root_child1_child2.getComputedLeft()).toBe(25); + expect(root_child1_child2.getComputedTop()).toBe(20); + expect(root_child1_child2.getComputedWidth()).toBe(25); + expect(root_child1_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child3.getComputedLeft(), "0 === root_child1_child3.getComputedLeft() (" + root_child1_child3.getComputedLeft() + ")"); - console.assert(20 === root_child1_child3.getComputedTop(), "20 === root_child1_child3.getComputedTop() (" + root_child1_child3.getComputedTop() + ")"); - console.assert(25 === root_child1_child3.getComputedWidth(), "25 === root_child1_child3.getComputedWidth() (" + root_child1_child3.getComputedWidth() + ")"); - console.assert(10 === root_child1_child3.getComputedHeight(), "10 === root_child1_child3.getComputedHeight() (" + root_child1_child3.getComputedHeight() + ")"); + expect(root_child1_child3.getComputedLeft()).toBe(0); + expect(root_child1_child3.getComputedTop()).toBe(20); + expect(root_child1_child3.getComputedWidth()).toBe(25); + expect(root_child1_child3.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -685,74 +685,74 @@ it("align_baseline_child_multiline_no_override_on_secondline", function () { config.free(); } }); -it("align_baseline_child_top", function () { - var config = Yoga.Config.create(); +test("align_baseline_child_top", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPosition(Yoga.EDGE_TOP, 10); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -761,74 +761,74 @@ it("align_baseline_child_top", function () { config.free(); } }); -it("align_baseline_child_top2", function () { - var config = Yoga.Config.create(); +test("align_baseline_child_top2", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setPosition(Yoga.EDGE_TOP, 5); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(45 === root_child1.getComputedTop(), "45 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(45); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(45 === root_child1.getComputedTop(), "45 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(45); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -837,88 +837,88 @@ it("align_baseline_child_top2", function () { config.free(); } }); -it("align_baseline_double_nested_child", function () { - var config = Yoga.Config.create(); +test("align_baseline_double_nested_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(50); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(15); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0.getComputedWidth(), "50 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(20); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(5 === root_child1.getComputedTop(), "5 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(5); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(15 === root_child1_child0.getComputedHeight(), "15 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(15); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0.getComputedWidth(), "50 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(5 === root_child1.getComputedTop(), "5 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(5); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(15 === root_child1_child0.getComputedHeight(), "15 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(15); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -927,57 +927,57 @@ it("align_baseline_double_nested_child", function () { config.free(); } }); -it("align_baseline_column", function () { - var config = Yoga.Config.create(); +test("align_baseline_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -986,17 +986,17 @@ it("align_baseline_column", function () { config.free(); } }); -it("align_baseline_child_margin", function () { - var config = Yoga.Config.create(); +test("align_baseline_child_margin", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, 5); root_child0.setMargin(Yoga.EDGE_TOP, 5); root_child0.setMargin(Yoga.EDGE_RIGHT, 5); @@ -1005,12 +1005,12 @@ it("align_baseline_child_margin", function () { root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setMargin(Yoga.EDGE_LEFT, 1); root_child1_child0.setMargin(Yoga.EDGE_TOP, 1); root_child1_child0.setMargin(Yoga.EDGE_RIGHT, 1); @@ -1020,47 +1020,47 @@ it("align_baseline_child_margin", function () { root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(5 === root_child0.getComputedTop(), "5 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(5); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(60 === root_child1.getComputedLeft(), "60 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(44 === root_child1.getComputedTop(), "44 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(60); + expect(root_child1.getComputedTop()).toBe(44); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(1 === root_child1_child0.getComputedLeft(), "1 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(1 === root_child1_child0.getComputedTop(), "1 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(1); + expect(root_child1_child0.getComputedTop()).toBe(1); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(5 === root_child0.getComputedTop(), "5 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(-10 === root_child1.getComputedLeft(), "-10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(44 === root_child1.getComputedTop(), "44 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(-10); + expect(root_child1.getComputedTop()).toBe(44); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(-1 === root_child1_child0.getComputedLeft(), "-1 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(1 === root_child1_child0.getComputedTop(), "1 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(-1); + expect(root_child1_child0.getComputedTop()).toBe(1); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1069,11 +1069,11 @@ it("align_baseline_child_margin", function () { config.free(); } }); -it("align_baseline_child_padding", function () { - var config = Yoga.Config.create(); +test("align_baseline_child_padding", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setPadding(Yoga.EDGE_LEFT, 5); @@ -1083,12 +1083,12 @@ it("align_baseline_child_padding", function () { root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setPadding(Yoga.EDGE_LEFT, 5); root_child1.setPadding(Yoga.EDGE_TOP, 5); root_child1.setPadding(Yoga.EDGE_RIGHT, 5); @@ -1097,53 +1097,53 @@ it("align_baseline_child_padding", function () { root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(5 === root_child0.getComputedTop(), "5 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(5); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(55 === root_child1.getComputedLeft(), "55 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(55); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(5 === root_child1_child0.getComputedLeft(), "5 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(5 === root_child1_child0.getComputedTop(), "5 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(5); + expect(root_child1_child0.getComputedTop()).toBe(5); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(5 === root_child0.getComputedTop(), "5 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(-5 === root_child1.getComputedLeft(), "-5 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(-5); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(-5 === root_child1_child0.getComputedLeft(), "-5 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(5 === root_child1_child0.getComputedTop(), "5 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(-5); + expect(root_child1_child0.getComputedTop()).toBe(5); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1152,119 +1152,119 @@ it("align_baseline_child_padding", function () { config.free(); } }); -it("align_baseline_multiline", function () { - var config = Yoga.Config.create(); +test("align_baseline_multiline", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(20); root.insertChild(root_child2, 2); - var root_child2_child0 = Yoga.Node.create(config); + const root_child2_child0 = Yoga.Node.create(config); root_child2_child0.setWidth(50); root_child2_child0.setHeight(10); root_child2.insertChild(root_child2_child0, 0); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(50); root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(100 === root_child2.getComputedTop(), "100 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(100); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child2_child0.getComputedLeft(), "0 === root_child2_child0.getComputedLeft() (" + root_child2_child0.getComputedLeft() + ")"); - console.assert(0 === root_child2_child0.getComputedTop(), "0 === root_child2_child0.getComputedTop() (" + root_child2_child0.getComputedTop() + ")"); - console.assert(50 === root_child2_child0.getComputedWidth(), "50 === root_child2_child0.getComputedWidth() (" + root_child2_child0.getComputedWidth() + ")"); - console.assert(10 === root_child2_child0.getComputedHeight(), "10 === root_child2_child0.getComputedHeight() (" + root_child2_child0.getComputedHeight() + ")"); + expect(root_child2_child0.getComputedLeft()).toBe(0); + expect(root_child2_child0.getComputedTop()).toBe(0); + expect(root_child2_child0.getComputedWidth()).toBe(50); + expect(root_child2_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(60 === root_child3.getComputedTop(), "60 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(60); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(100 === root_child2.getComputedTop(), "100 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(100); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child2_child0.getComputedLeft(), "0 === root_child2_child0.getComputedLeft() (" + root_child2_child0.getComputedLeft() + ")"); - console.assert(0 === root_child2_child0.getComputedTop(), "0 === root_child2_child0.getComputedTop() (" + root_child2_child0.getComputedTop() + ")"); - console.assert(50 === root_child2_child0.getComputedWidth(), "50 === root_child2_child0.getComputedWidth() (" + root_child2_child0.getComputedWidth() + ")"); - console.assert(10 === root_child2_child0.getComputedHeight(), "10 === root_child2_child0.getComputedHeight() (" + root_child2_child0.getComputedHeight() + ")"); + expect(root_child2_child0.getComputedLeft()).toBe(0); + expect(root_child2_child0.getComputedTop()).toBe(0); + expect(root_child2_child0.getComputedWidth()).toBe(50); + expect(root_child2_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(60 === root_child3.getComputedTop(), "60 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(50 === root_child3.getComputedHeight(), "50 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(60); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1273,118 +1273,118 @@ it("align_baseline_multiline", function () { config.free(); } }); -it("align_baseline_multiline_column", function () { - var config = Yoga.Config.create(); +test("align_baseline_multiline_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(20); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root_child2.setHeight(70); root.insertChild(root_child2, 2); - var root_child2_child0 = Yoga.Node.create(config); + const root_child2_child0 = Yoga.Node.create(config); root_child2_child0.setWidth(10); root_child2_child0.setHeight(10); root_child2.insertChild(root_child2_child0, 0); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(20); root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(20 === root_child1_child0.getComputedWidth(), "20 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(20); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(40 === root_child2.getComputedWidth(), "40 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(70 === root_child2.getComputedHeight(), "70 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(40); + expect(root_child2.getComputedHeight()).toBe(70); - console.assert(0 === root_child2_child0.getComputedLeft(), "0 === root_child2_child0.getComputedLeft() (" + root_child2_child0.getComputedLeft() + ")"); - console.assert(0 === root_child2_child0.getComputedTop(), "0 === root_child2_child0.getComputedTop() (" + root_child2_child0.getComputedTop() + ")"); - console.assert(10 === root_child2_child0.getComputedWidth(), "10 === root_child2_child0.getComputedWidth() (" + root_child2_child0.getComputedWidth() + ")"); - console.assert(10 === root_child2_child0.getComputedHeight(), "10 === root_child2_child0.getComputedHeight() (" + root_child2_child0.getComputedHeight() + ")"); + expect(root_child2_child0.getComputedLeft()).toBe(0); + expect(root_child2_child0.getComputedTop()).toBe(0); + expect(root_child2_child0.getComputedWidth()).toBe(10); + expect(root_child2_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(70 === root_child3.getComputedTop(), "70 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(70); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(70); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(10 === root_child1_child0.getComputedLeft(), "10 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(20 === root_child1_child0.getComputedWidth(), "20 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(10); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(20); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(40 === root_child2.getComputedWidth(), "40 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(70 === root_child2.getComputedHeight(), "70 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(40); + expect(root_child2.getComputedHeight()).toBe(70); - console.assert(30 === root_child2_child0.getComputedLeft(), "30 === root_child2_child0.getComputedLeft() (" + root_child2_child0.getComputedLeft() + ")"); - console.assert(0 === root_child2_child0.getComputedTop(), "0 === root_child2_child0.getComputedTop() (" + root_child2_child0.getComputedTop() + ")"); - console.assert(10 === root_child2_child0.getComputedWidth(), "10 === root_child2_child0.getComputedWidth() (" + root_child2_child0.getComputedWidth() + ")"); - console.assert(10 === root_child2_child0.getComputedHeight(), "10 === root_child2_child0.getComputedHeight() (" + root_child2_child0.getComputedHeight() + ")"); + expect(root_child2_child0.getComputedLeft()).toBe(30); + expect(root_child2_child0.getComputedTop()).toBe(0); + expect(root_child2_child0.getComputedWidth()).toBe(10); + expect(root_child2_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(70 === root_child3.getComputedTop(), "70 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(70); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1393,118 +1393,118 @@ it("align_baseline_multiline_column", function () { config.free(); } }); -it("align_baseline_multiline_column2", function () { - var config = Yoga.Config.create(); +test("align_baseline_multiline_column2", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(20); root_child1_child0.setHeight(20); root_child1.insertChild(root_child1_child0, 0); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(40); root_child2.setHeight(70); root.insertChild(root_child2, 2); - var root_child2_child0 = Yoga.Node.create(config); + const root_child2_child0 = Yoga.Node.create(config); root_child2_child0.setWidth(10); root_child2_child0.setHeight(10); root_child2.insertChild(root_child2_child0, 0); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(20); root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(20 === root_child1_child0.getComputedWidth(), "20 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(20); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(40 === root_child2.getComputedWidth(), "40 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(70 === root_child2.getComputedHeight(), "70 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(40); + expect(root_child2.getComputedHeight()).toBe(70); - console.assert(0 === root_child2_child0.getComputedLeft(), "0 === root_child2_child0.getComputedLeft() (" + root_child2_child0.getComputedLeft() + ")"); - console.assert(0 === root_child2_child0.getComputedTop(), "0 === root_child2_child0.getComputedTop() (" + root_child2_child0.getComputedTop() + ")"); - console.assert(10 === root_child2_child0.getComputedWidth(), "10 === root_child2_child0.getComputedWidth() (" + root_child2_child0.getComputedWidth() + ")"); - console.assert(10 === root_child2_child0.getComputedHeight(), "10 === root_child2_child0.getComputedHeight() (" + root_child2_child0.getComputedHeight() + ")"); + expect(root_child2_child0.getComputedLeft()).toBe(0); + expect(root_child2_child0.getComputedTop()).toBe(0); + expect(root_child2_child0.getComputedWidth()).toBe(10); + expect(root_child2_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(70 === root_child3.getComputedTop(), "70 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(70); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(70); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(10 === root_child1_child0.getComputedLeft(), "10 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(20 === root_child1_child0.getComputedWidth(), "20 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(20 === root_child1_child0.getComputedHeight(), "20 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(10); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(20); + expect(root_child1_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(40 === root_child2.getComputedWidth(), "40 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(70 === root_child2.getComputedHeight(), "70 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(40); + expect(root_child2.getComputedHeight()).toBe(70); - console.assert(30 === root_child2_child0.getComputedLeft(), "30 === root_child2_child0.getComputedLeft() (" + root_child2_child0.getComputedLeft() + ")"); - console.assert(0 === root_child2_child0.getComputedTop(), "0 === root_child2_child0.getComputedTop() (" + root_child2_child0.getComputedTop() + ")"); - console.assert(10 === root_child2_child0.getComputedWidth(), "10 === root_child2_child0.getComputedWidth() (" + root_child2_child0.getComputedWidth() + ")"); - console.assert(10 === root_child2_child0.getComputedHeight(), "10 === root_child2_child0.getComputedHeight() (" + root_child2_child0.getComputedHeight() + ")"); + expect(root_child2_child0.getComputedLeft()).toBe(30); + expect(root_child2_child0.getComputedTop()).toBe(0); + expect(root_child2_child0.getComputedWidth()).toBe(10); + expect(root_child2_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(70 === root_child3.getComputedTop(), "70 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(70); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1513,119 +1513,119 @@ it("align_baseline_multiline_column2", function () { config.free(); } }); -it("align_baseline_multiline_row_and_column", function () { - var config = Yoga.Config.create(); +test("align_baseline_multiline_row_and_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_BASELINE); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(20); root.insertChild(root_child2, 2); - var root_child2_child0 = Yoga.Node.create(config); + const root_child2_child0 = Yoga.Node.create(config); root_child2_child0.setWidth(50); root_child2_child0.setHeight(10); root_child2.insertChild(root_child2_child0, 0); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(50); root_child3.setHeight(20); root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(100 === root_child2.getComputedTop(), "100 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(100); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child2_child0.getComputedLeft(), "0 === root_child2_child0.getComputedLeft() (" + root_child2_child0.getComputedLeft() + ")"); - console.assert(0 === root_child2_child0.getComputedTop(), "0 === root_child2_child0.getComputedTop() (" + root_child2_child0.getComputedTop() + ")"); - console.assert(50 === root_child2_child0.getComputedWidth(), "50 === root_child2_child0.getComputedWidth() (" + root_child2_child0.getComputedWidth() + ")"); - console.assert(10 === root_child2_child0.getComputedHeight(), "10 === root_child2_child0.getComputedHeight() (" + root_child2_child0.getComputedHeight() + ")"); + expect(root_child2_child0.getComputedLeft()).toBe(0); + expect(root_child2_child0.getComputedTop()).toBe(0); + expect(root_child2_child0.getComputedWidth()).toBe(50); + expect(root_child2_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child3.getComputedLeft(), "50 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(90 === root_child3.getComputedTop(), "90 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(50); + expect(root_child3.getComputedTop()).toBe(90); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(100 === root_child2.getComputedTop(), "100 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(100); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child2_child0.getComputedLeft(), "0 === root_child2_child0.getComputedLeft() (" + root_child2_child0.getComputedLeft() + ")"); - console.assert(0 === root_child2_child0.getComputedTop(), "0 === root_child2_child0.getComputedTop() (" + root_child2_child0.getComputedTop() + ")"); - console.assert(50 === root_child2_child0.getComputedWidth(), "50 === root_child2_child0.getComputedWidth() (" + root_child2_child0.getComputedWidth() + ")"); - console.assert(10 === root_child2_child0.getComputedHeight(), "10 === root_child2_child0.getComputedHeight() (" + root_child2_child0.getComputedHeight() + ")"); + expect(root_child2_child0.getComputedLeft()).toBe(0); + expect(root_child2_child0.getComputedTop()).toBe(0); + expect(root_child2_child0.getComputedWidth()).toBe(50); + expect(root_child2_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(90 === root_child3.getComputedTop(), "90 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(50 === root_child3.getComputedWidth(), "50 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(90); + expect(root_child3.getComputedWidth()).toBe(50); + expect(root_child3.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1634,21 +1634,21 @@ it("align_baseline_multiline_row_and_column", function () { config.free(); } }); -it("align_items_center_child_with_margin_bigger_than_parent", function () { - var config = Yoga.Config.create(); +test("align_items_center_child_with_margin_bigger_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(52); root.setHeight(52); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Yoga.ALIGN_CENTER); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setMargin(Yoga.EDGE_LEFT, 10); root_child0_child0.setMargin(Yoga.EDGE_RIGHT, 10); root_child0_child0.setWidth(52); @@ -1656,37 +1656,37 @@ it("align_items_center_child_with_margin_bigger_than_parent", function () { root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-10 === root_child0.getComputedLeft(), "-10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(52 === root_child0.getComputedHeight(), "52 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(52); - console.assert(10 === root_child0_child0.getComputedLeft(), "10 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(52 === root_child0_child0.getComputedWidth(), "52 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(52 === root_child0_child0.getComputedHeight(), "52 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(10); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(52); + expect(root_child0_child0.getComputedHeight()).toBe(52); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-10 === root_child0.getComputedLeft(), "-10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(52 === root_child0.getComputedHeight(), "52 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(52); - console.assert(10 === root_child0_child0.getComputedLeft(), "10 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(52 === root_child0_child0.getComputedWidth(), "52 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(52 === root_child0_child0.getComputedHeight(), "52 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(10); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(52); + expect(root_child0_child0.getComputedHeight()).toBe(52); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1695,21 +1695,21 @@ it("align_items_center_child_with_margin_bigger_than_parent", function () { config.free(); } }); -it("align_items_flex_end_child_with_margin_bigger_than_parent", function () { - var config = Yoga.Config.create(); +test("align_items_flex_end_child_with_margin_bigger_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(52); root.setHeight(52); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Yoga.ALIGN_FLEX_END); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setMargin(Yoga.EDGE_LEFT, 10); root_child0_child0.setMargin(Yoga.EDGE_RIGHT, 10); root_child0_child0.setWidth(52); @@ -1717,37 +1717,37 @@ it("align_items_flex_end_child_with_margin_bigger_than_parent", function () { root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-10 === root_child0.getComputedLeft(), "-10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(52 === root_child0.getComputedHeight(), "52 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(52); - console.assert(10 === root_child0_child0.getComputedLeft(), "10 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(52 === root_child0_child0.getComputedWidth(), "52 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(52 === root_child0_child0.getComputedHeight(), "52 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(10); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(52); + expect(root_child0_child0.getComputedHeight()).toBe(52); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-10 === root_child0.getComputedLeft(), "-10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(52 === root_child0.getComputedHeight(), "52 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(52); - console.assert(10 === root_child0_child0.getComputedLeft(), "10 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(52 === root_child0_child0.getComputedWidth(), "52 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(52 === root_child0_child0.getComputedHeight(), "52 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(10); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(52); + expect(root_child0_child0.getComputedHeight()).toBe(52); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1756,57 +1756,57 @@ it("align_items_flex_end_child_with_margin_bigger_than_parent", function () { config.free(); } }); -it("align_items_center_child_without_margin_bigger_than_parent", function () { - var config = Yoga.Config.create(); +test("align_items_center_child_without_margin_bigger_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(52); root.setHeight(52); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Yoga.ALIGN_CENTER); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(72); root_child0_child0.setHeight(72); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-10 === root_child0.getComputedLeft(), "-10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(72 === root_child0_child0.getComputedWidth(), "72 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0.getComputedHeight(), "72 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(72); + expect(root_child0_child0.getComputedHeight()).toBe(72); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-10 === root_child0.getComputedLeft(), "-10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(72 === root_child0_child0.getComputedWidth(), "72 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0.getComputedHeight(), "72 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(72); + expect(root_child0_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1815,57 +1815,57 @@ it("align_items_center_child_without_margin_bigger_than_parent", function () { config.free(); } }); -it("align_items_flex_end_child_without_margin_bigger_than_parent", function () { - var config = Yoga.Config.create(); +test("align_items_flex_end_child_without_margin_bigger_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(52); root.setHeight(52); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Yoga.ALIGN_FLEX_END); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(72); root_child0_child0.setHeight(72); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-10 === root_child0.getComputedLeft(), "-10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(72 === root_child0_child0.getComputedWidth(), "72 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0.getComputedHeight(), "72 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(72); + expect(root_child0_child0.getComputedHeight()).toBe(72); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-10 === root_child0.getComputedLeft(), "-10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-10); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(72 === root_child0_child0.getComputedWidth(), "72 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0.getComputedHeight(), "72 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(72); + expect(root_child0_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1874,73 +1874,73 @@ it("align_items_flex_end_child_without_margin_bigger_than_parent", function () { config.free(); } }); -it("align_center_should_size_based_on_content", function () { - var config = Yoga.Config.create(); +test("align_center_should_size_based_on_content", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setMargin(Yoga.EDGE_TOP, 20); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setJustifyContent(Yoga.JUSTIFY_CENTER); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(20); root_child0_child0_child0.setHeight(20); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(20 === root.getComputedTop(), "20 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(20); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(40); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(20 === root_child0_child0.getComputedWidth(), "20 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(20 === root_child0_child0_child0.getComputedWidth(), "20 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0_child0.getComputedHeight(), "20 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(20 === root.getComputedTop(), "20 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(20); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(40); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(20 === root_child0_child0.getComputedWidth(), "20 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(20 === root_child0_child0_child0.getComputedWidth(), "20 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0_child0.getComputedHeight(), "20 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1949,72 +1949,72 @@ it("align_center_should_size_based_on_content", function () { config.free(); } }); -it("align_stretch_should_size_based_on_parent", function () { - var config = Yoga.Config.create(); +test("align_stretch_should_size_based_on_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setMargin(Yoga.EDGE_TOP, 20); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setJustifyContent(Yoga.JUSTIFY_CENTER); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(20); root_child0_child0_child0.setHeight(20); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(20 === root.getComputedTop(), "20 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(20); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(20 === root_child0_child0_child0.getComputedWidth(), "20 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0_child0.getComputedHeight(), "20 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(20 === root.getComputedTop(), "20 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(20); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(20); - console.assert(80 === root_child0_child0_child0.getComputedLeft(), "80 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(20 === root_child0_child0_child0.getComputedWidth(), "20 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0_child0.getComputedHeight(), "20 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(80); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(20); + expect(root_child0_child0_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -2023,70 +2023,70 @@ it("align_stretch_should_size_based_on_parent", function () { config.free(); } }); -it("align_flex_start_with_shrinking_children", function () { - var config = Yoga.Config.create(); +test("align_flex_start_with_shrinking_children", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(500); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Yoga.ALIGN_FLEX_START); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexGrow(1); root_child0_child0_child0.setFlexShrink(1); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedWidth(), "0 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(500 === root_child0_child0.getComputedLeft(), "500 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(500); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedWidth(), "0 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0_child0.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -2095,69 +2095,69 @@ it("align_flex_start_with_shrinking_children", function () { config.free(); } }); -it("align_flex_start_with_stretching_children", function () { - var config = Yoga.Config.create(); +test("align_flex_start_with_stretching_children", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(500); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexGrow(1); root_child0_child0_child0.setFlexShrink(1); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(500 === root_child0_child0.getComputedWidth(), "500 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(500); + expect(root_child0_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(500 === root_child0_child0_child0.getComputedWidth(), "500 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(500); + expect(root_child0_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(500 === root_child0_child0.getComputedWidth(), "500 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(500); + expect(root_child0_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(500 === root_child0_child0_child0.getComputedWidth(), "500 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(500); + expect(root_child0_child0_child0.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -2166,70 +2166,70 @@ it("align_flex_start_with_stretching_children", function () { config.free(); } }); -it("align_flex_start_with_shrinking_children_with_stretch", function () { - var config = Yoga.Config.create(); +test("align_flex_start_with_shrinking_children_with_stretch", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(500); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignItems(Yoga.ALIGN_FLEX_START); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexGrow(1); root_child0_child0_child0.setFlexShrink(1); root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedWidth(), "0 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(500 === root_child0.getComputedWidth(), "500 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(500); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(500 === root_child0_child0.getComputedLeft(), "500 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(500); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedWidth(), "0 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedHeight(), "0 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0_child0.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGAlignSelfTest.test.js b/javascript/tests/generated/YGAlignSelfTest.test.js index 554c2e1d..da288597 100644 --- a/javascript/tests/generated/YGAlignSelfTest.test.js +++ b/javascript/tests/generated/YGAlignSelfTest.test.js @@ -7,42 +7,42 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGAlignSelfTest.html -it("align_self_center", function () { - var config = Yoga.Config.create(); +test("align_self_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignSelf(Yoga.ALIGN_CENTER); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -51,42 +51,42 @@ it("align_self_center", function () { config.free(); } }); -it("align_self_flex_end", function () { - var config = Yoga.Config.create(); +test("align_self_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignSelf(Yoga.ALIGN_FLEX_END); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -95,42 +95,42 @@ it("align_self_flex_end", function () { config.free(); } }); -it("align_self_flex_start", function () { - var config = Yoga.Config.create(); +test("align_self_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignSelf(Yoga.ALIGN_FLEX_START); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -139,43 +139,43 @@ it("align_self_flex_start", function () { config.free(); } }); -it("align_self_flex_end_override_flex_start", function () { - var config = Yoga.Config.create(); +test("align_self_flex_end_override_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignSelf(Yoga.ALIGN_FLEX_END); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -184,74 +184,74 @@ it("align_self_flex_end_override_flex_start", function () { config.free(); } }); -it("align_self_baseline", function () { - var config = Yoga.Config.create(); +test("align_self_baseline", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setAlignSelf(Yoga.ALIGN_BASELINE); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setAlignSelf(Yoga.ALIGN_BASELINE); root_child1.setWidth(50); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth(50); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(50 === root_child1_child0.getComputedWidth(), "50 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(50); + expect(root_child1_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGAndroidNewsFeed.test.js b/javascript/tests/generated/YGAndroidNewsFeed.test.js index c18a3b8e..a553a786 100644 --- a/javascript/tests/generated/YGAndroidNewsFeed.test.js +++ b/javascript/tests/generated/YGAndroidNewsFeed.test.js @@ -7,26 +7,26 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGAndroidNewsFeed.html -it("android_news_feed", function () { - var config = Yoga.Config.create(); +test("android_news_feed", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setWidth(1080); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0.insertChild(root_child0_child0_child0, 0); - var root_child0_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child0_child0.setAlignItems(Yoga.ALIGN_FLEX_START); @@ -34,18 +34,18 @@ it("android_news_feed", function () { root_child0_child0_child0_child0.setMargin(Yoga.EDGE_TOP, 24); root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0); - var root_child0_child0_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0, 0); - var root_child0_child0_child0_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child0_child0_child0_child0.setWidth(120); root_child0_child0_child0_child0_child0_child0.setHeight(120); root_child0_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child0_child0, 0); - var root_child0_child0_child0_child0_child1 = Yoga.Node.create(config); + const root_child0_child0_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child0_child0_child1.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child0_child0_child1.setFlexShrink(1); root_child0_child0_child0_child0_child1.setMargin(Yoga.EDGE_RIGHT, 36); @@ -55,22 +55,22 @@ it("android_news_feed", function () { root_child0_child0_child0_child0_child1.setPadding(Yoga.EDGE_BOTTOM, 18); root_child0_child0_child0_child0.insertChild(root_child0_child0_child0_child0_child1, 1); - var root_child0_child0_child0_child0_child1_child0 = Yoga.Node.create(config); + const root_child0_child0_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child0_child0_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0_child0_child0_child1_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child0_child0_child1_child0.setFlexShrink(1); root_child0_child0_child0_child0_child1.insertChild(root_child0_child0_child0_child0_child1_child0, 0); - var root_child0_child0_child0_child0_child1_child1 = Yoga.Node.create(config); + const root_child0_child0_child0_child0_child1_child1 = Yoga.Node.create(config); root_child0_child0_child0_child0_child1_child1.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child0_child0_child1_child1.setFlexShrink(1); root_child0_child0_child0_child0_child1.insertChild(root_child0_child0_child0_child0_child1_child1, 1); - var root_child0_child0_child1 = Yoga.Node.create(config); + const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0.insertChild(root_child0_child0_child1, 1); - var root_child0_child0_child1_child0 = Yoga.Node.create(config); + const root_child0_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0_child1_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child1_child0.setAlignItems(Yoga.ALIGN_FLEX_START); @@ -78,18 +78,18 @@ it("android_news_feed", function () { root_child0_child0_child1_child0.setMargin(Yoga.EDGE_TOP, 24); root_child0_child0_child1.insertChild(root_child0_child0_child1_child0, 0); - var root_child0_child0_child1_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child1_child0_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0_child1_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child1_child0.insertChild(root_child0_child0_child1_child0_child0, 0); - var root_child0_child0_child1_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child1_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child1_child0_child0_child0.setWidth(72); root_child0_child0_child1_child0_child0_child0.setHeight(72); root_child0_child0_child1_child0_child0.insertChild(root_child0_child0_child1_child0_child0_child0, 0); - var root_child0_child0_child1_child0_child1 = Yoga.Node.create(config); + const root_child0_child0_child1_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1_child0_child1.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child1_child0_child1.setFlexShrink(1); root_child0_child0_child1_child0_child1.setMargin(Yoga.EDGE_RIGHT, 36); @@ -99,189 +99,189 @@ it("android_news_feed", function () { root_child0_child0_child1_child0_child1.setPadding(Yoga.EDGE_BOTTOM, 18); root_child0_child0_child1_child0.insertChild(root_child0_child0_child1_child0_child1, 1); - var root_child0_child0_child1_child0_child1_child0 = Yoga.Node.create(config); + const root_child0_child0_child1_child0_child1_child0 = Yoga.Node.create(config); root_child0_child0_child1_child0_child1_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0_child1_child0_child1_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child1_child0_child1_child0.setFlexShrink(1); root_child0_child0_child1_child0_child1.insertChild(root_child0_child0_child1_child0_child1_child0, 0); - var root_child0_child0_child1_child0_child1_child1 = Yoga.Node.create(config); + const root_child0_child0_child1_child0_child1_child1 = Yoga.Node.create(config); root_child0_child0_child1_child0_child1_child1.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child1_child0_child1_child1.setFlexShrink(1); root_child0_child0_child1_child0_child1.insertChild(root_child0_child0_child1_child0_child1_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(1080 === root.getComputedWidth(), "1080 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(240 === root.getComputedHeight(), "240 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(1080); + expect(root.getComputedHeight()).toBe(240); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(1080 === root_child0.getComputedWidth(), "1080 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(240 === root_child0.getComputedHeight(), "240 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1080); + expect(root_child0.getComputedHeight()).toBe(240); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(1080 === root_child0_child0.getComputedWidth(), "1080 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(240 === root_child0_child0.getComputedHeight(), "240 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(1080); + expect(root_child0_child0.getComputedHeight()).toBe(240); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(1080 === root_child0_child0_child0.getComputedWidth(), "1080 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(144 === root_child0_child0_child0.getComputedHeight(), "144 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(1080); + expect(root_child0_child0_child0.getComputedHeight()).toBe(144); - console.assert(36 === root_child0_child0_child0_child0.getComputedLeft(), "36 === root_child0_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0_child0.getComputedLeft() + ")"); - console.assert(24 === root_child0_child0_child0_child0.getComputedTop(), "24 === root_child0_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0_child0.getComputedTop() + ")"); - console.assert(1044 === root_child0_child0_child0_child0.getComputedWidth(), "1044 === root_child0_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0_child0_child0_child0.getComputedHeight(), "120 === root_child0_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(36); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(24); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(1044); + expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(120); - console.assert(0 === root_child0_child0_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0_child0_child0.getComputedTop() + ")"); - console.assert(120 === root_child0_child0_child0_child0_child0.getComputedWidth(), "120 === root_child0_child0_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0_child0_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0_child0_child0_child0_child0.getComputedHeight(), "120 === root_child0_child0_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0_child0_child0.getComputedWidth()).toBe(120); + expect(root_child0_child0_child0_child0_child0.getComputedHeight()).toBe(120); - console.assert(0 === root_child0_child0_child0_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0_child0_child0_child0.getComputedTop() + ")"); - console.assert(120 === root_child0_child0_child0_child0_child0_child0.getComputedWidth(), "120 === root_child0_child0_child0_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0_child0_child0_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0_child0_child0_child0_child0_child0.getComputedHeight(), "120 === root_child0_child0_child0_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0_child0_child0_child0.getComputedWidth()).toBe(120); + expect(root_child0_child0_child0_child0_child0_child0.getComputedHeight()).toBe(120); - console.assert(120 === root_child0_child0_child0_child0_child1.getComputedLeft(), "120 === root_child0_child0_child0_child0_child1.getComputedLeft() (" + root_child0_child0_child0_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1.getComputedTop(), "0 === root_child0_child0_child0_child0_child1.getComputedTop() (" + root_child0_child0_child0_child0_child1.getComputedTop() + ")"); - console.assert(72 === root_child0_child0_child0_child0_child1.getComputedWidth(), "72 === root_child0_child0_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child0_child0_child1.getComputedWidth() + ")"); - console.assert(39 === root_child0_child0_child0_child0_child1.getComputedHeight(), "39 === root_child0_child0_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child0_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child1.getComputedLeft()).toBe(120); + expect(root_child0_child0_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child0_child0_child1.getComputedWidth()).toBe(72); + expect(root_child0_child0_child0_child0_child1.getComputedHeight()).toBe(39); - console.assert(36 === root_child0_child0_child0_child0_child1_child0.getComputedLeft(), "36 === root_child0_child0_child0_child0_child1_child0.getComputedLeft() (" + root_child0_child0_child0_child0_child1_child0.getComputedLeft() + ")"); - console.assert(21 === root_child0_child0_child0_child0_child1_child0.getComputedTop(), "21 === root_child0_child0_child0_child0_child1_child0.getComputedTop() (" + root_child0_child0_child0_child0_child1_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1_child0.getComputedWidth(), "0 === root_child0_child0_child0_child0_child1_child0.getComputedWidth() (" + root_child0_child0_child0_child0_child1_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1_child0.getComputedHeight(), "0 === root_child0_child0_child0_child0_child1_child0.getComputedHeight() (" + root_child0_child0_child0_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child1_child0.getComputedLeft()).toBe(36); + expect(root_child0_child0_child0_child0_child1_child0.getComputedTop()).toBe(21); + expect(root_child0_child0_child0_child0_child1_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0_child0_child0_child1_child0.getComputedHeight()).toBe(0); - console.assert(36 === root_child0_child0_child0_child0_child1_child1.getComputedLeft(), "36 === root_child0_child0_child0_child0_child1_child1.getComputedLeft() (" + root_child0_child0_child0_child0_child1_child1.getComputedLeft() + ")"); - console.assert(21 === root_child0_child0_child0_child0_child1_child1.getComputedTop(), "21 === root_child0_child0_child0_child0_child1_child1.getComputedTop() (" + root_child0_child0_child0_child0_child1_child1.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1_child1.getComputedWidth(), "0 === root_child0_child0_child0_child0_child1_child1.getComputedWidth() (" + root_child0_child0_child0_child0_child1_child1.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1_child1.getComputedHeight(), "0 === root_child0_child0_child0_child0_child1_child1.getComputedHeight() (" + root_child0_child0_child0_child0_child1_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child1_child1.getComputedLeft()).toBe(36); + expect(root_child0_child0_child0_child0_child1_child1.getComputedTop()).toBe(21); + expect(root_child0_child0_child0_child0_child1_child1.getComputedWidth()).toBe(0); + expect(root_child0_child0_child0_child0_child1_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0_child1.getComputedLeft(), "0 === root_child0_child0_child1.getComputedLeft() (" + root_child0_child0_child1.getComputedLeft() + ")"); - console.assert(144 === root_child0_child0_child1.getComputedTop(), "144 === root_child0_child0_child1.getComputedTop() (" + root_child0_child0_child1.getComputedTop() + ")"); - console.assert(1080 === root_child0_child0_child1.getComputedWidth(), "1080 === root_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child1.getComputedWidth() + ")"); - console.assert(96 === root_child0_child0_child1.getComputedHeight(), "96 === root_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(144); + expect(root_child0_child0_child1.getComputedWidth()).toBe(1080); + expect(root_child0_child0_child1.getComputedHeight()).toBe(96); - console.assert(174 === root_child0_child0_child1_child0.getComputedLeft(), "174 === root_child0_child0_child1_child0.getComputedLeft() (" + root_child0_child0_child1_child0.getComputedLeft() + ")"); - console.assert(24 === root_child0_child0_child1_child0.getComputedTop(), "24 === root_child0_child0_child1_child0.getComputedTop() (" + root_child0_child0_child1_child0.getComputedTop() + ")"); - console.assert(906 === root_child0_child0_child1_child0.getComputedWidth(), "906 === root_child0_child0_child1_child0.getComputedWidth() (" + root_child0_child0_child1_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0_child1_child0.getComputedHeight(), "72 === root_child0_child0_child1_child0.getComputedHeight() (" + root_child0_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(174); + expect(root_child0_child0_child1_child0.getComputedTop()).toBe(24); + expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(906); + expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(72); - console.assert(0 === root_child0_child0_child1_child0_child0.getComputedLeft(), "0 === root_child0_child0_child1_child0_child0.getComputedLeft() (" + root_child0_child0_child1_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child0.getComputedTop(), "0 === root_child0_child0_child1_child0_child0.getComputedTop() (" + root_child0_child0_child1_child0_child0.getComputedTop() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child0.getComputedWidth(), "72 === root_child0_child0_child1_child0_child0.getComputedWidth() (" + root_child0_child0_child1_child0_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child0.getComputedHeight(), "72 === root_child0_child0_child1_child0_child0.getComputedHeight() (" + root_child0_child0_child1_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child1_child0_child0.getComputedWidth()).toBe(72); + expect(root_child0_child0_child1_child0_child0.getComputedHeight()).toBe(72); - console.assert(0 === root_child0_child0_child1_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child1_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child1_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child1_child0_child0_child0.getComputedTop() (" + root_child0_child0_child1_child0_child0_child0.getComputedTop() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child0_child0.getComputedWidth(), "72 === root_child0_child0_child1_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child1_child0_child0_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child0_child0.getComputedHeight(), "72 === root_child0_child0_child1_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child1_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child1_child0_child0_child0.getComputedWidth()).toBe(72); + expect(root_child0_child0_child1_child0_child0_child0.getComputedHeight()).toBe(72); - console.assert(72 === root_child0_child0_child1_child0_child1.getComputedLeft(), "72 === root_child0_child0_child1_child0_child1.getComputedLeft() (" + root_child0_child0_child1_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1.getComputedTop(), "0 === root_child0_child0_child1_child0_child1.getComputedTop() (" + root_child0_child0_child1_child0_child1.getComputedTop() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child1.getComputedWidth(), "72 === root_child0_child0_child1_child0_child1.getComputedWidth() (" + root_child0_child0_child1_child0_child1.getComputedWidth() + ")"); - console.assert(39 === root_child0_child0_child1_child0_child1.getComputedHeight(), "39 === root_child0_child0_child1_child0_child1.getComputedHeight() (" + root_child0_child0_child1_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child1.getComputedLeft()).toBe(72); + expect(root_child0_child0_child1_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1_child0_child1.getComputedWidth()).toBe(72); + expect(root_child0_child0_child1_child0_child1.getComputedHeight()).toBe(39); - console.assert(36 === root_child0_child0_child1_child0_child1_child0.getComputedLeft(), "36 === root_child0_child0_child1_child0_child1_child0.getComputedLeft() (" + root_child0_child0_child1_child0_child1_child0.getComputedLeft() + ")"); - console.assert(21 === root_child0_child0_child1_child0_child1_child0.getComputedTop(), "21 === root_child0_child0_child1_child0_child1_child0.getComputedTop() (" + root_child0_child0_child1_child0_child1_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1_child0.getComputedWidth(), "0 === root_child0_child0_child1_child0_child1_child0.getComputedWidth() (" + root_child0_child0_child1_child0_child1_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1_child0.getComputedHeight(), "0 === root_child0_child0_child1_child0_child1_child0.getComputedHeight() (" + root_child0_child0_child1_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child1_child0.getComputedLeft()).toBe(36); + expect(root_child0_child0_child1_child0_child1_child0.getComputedTop()).toBe(21); + expect(root_child0_child0_child1_child0_child1_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0_child1_child0_child1_child0.getComputedHeight()).toBe(0); - console.assert(36 === root_child0_child0_child1_child0_child1_child1.getComputedLeft(), "36 === root_child0_child0_child1_child0_child1_child1.getComputedLeft() (" + root_child0_child0_child1_child0_child1_child1.getComputedLeft() + ")"); - console.assert(21 === root_child0_child0_child1_child0_child1_child1.getComputedTop(), "21 === root_child0_child0_child1_child0_child1_child1.getComputedTop() (" + root_child0_child0_child1_child0_child1_child1.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1_child1.getComputedWidth(), "0 === root_child0_child0_child1_child0_child1_child1.getComputedWidth() (" + root_child0_child0_child1_child0_child1_child1.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1_child1.getComputedHeight(), "0 === root_child0_child0_child1_child0_child1_child1.getComputedHeight() (" + root_child0_child0_child1_child0_child1_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child1_child1.getComputedLeft()).toBe(36); + expect(root_child0_child0_child1_child0_child1_child1.getComputedTop()).toBe(21); + expect(root_child0_child0_child1_child0_child1_child1.getComputedWidth()).toBe(0); + expect(root_child0_child0_child1_child0_child1_child1.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(1080 === root.getComputedWidth(), "1080 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(240 === root.getComputedHeight(), "240 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(1080); + expect(root.getComputedHeight()).toBe(240); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(1080 === root_child0.getComputedWidth(), "1080 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(240 === root_child0.getComputedHeight(), "240 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1080); + expect(root_child0.getComputedHeight()).toBe(240); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(1080 === root_child0_child0.getComputedWidth(), "1080 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(240 === root_child0_child0.getComputedHeight(), "240 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(1080); + expect(root_child0_child0.getComputedHeight()).toBe(240); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(1080 === root_child0_child0_child0.getComputedWidth(), "1080 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(144 === root_child0_child0_child0.getComputedHeight(), "144 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(1080); + expect(root_child0_child0_child0.getComputedHeight()).toBe(144); - console.assert(0 === root_child0_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0_child0.getComputedLeft() + ")"); - console.assert(24 === root_child0_child0_child0_child0.getComputedTop(), "24 === root_child0_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0_child0.getComputedTop() + ")"); - console.assert(1044 === root_child0_child0_child0_child0.getComputedWidth(), "1044 === root_child0_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0_child0_child0_child0.getComputedHeight(), "120 === root_child0_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0_child0.getComputedTop()).toBe(24); + expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(1044); + expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(120); - console.assert(924 === root_child0_child0_child0_child0_child0.getComputedLeft(), "924 === root_child0_child0_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0_child0_child0.getComputedTop() + ")"); - console.assert(120 === root_child0_child0_child0_child0_child0.getComputedWidth(), "120 === root_child0_child0_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0_child0_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0_child0_child0_child0_child0.getComputedHeight(), "120 === root_child0_child0_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child0.getComputedLeft()).toBe(924); + expect(root_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0_child0_child0.getComputedWidth()).toBe(120); + expect(root_child0_child0_child0_child0_child0.getComputedHeight()).toBe(120); - console.assert(0 === root_child0_child0_child0_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0_child0_child0_child0.getComputedTop() + ")"); - console.assert(120 === root_child0_child0_child0_child0_child0_child0.getComputedWidth(), "120 === root_child0_child0_child0_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0_child0_child0_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0_child0_child0_child0_child0_child0.getComputedHeight(), "120 === root_child0_child0_child0_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0_child0_child0_child0.getComputedWidth()).toBe(120); + expect(root_child0_child0_child0_child0_child0_child0.getComputedHeight()).toBe(120); - console.assert(816 === root_child0_child0_child0_child0_child1.getComputedLeft(), "816 === root_child0_child0_child0_child0_child1.getComputedLeft() (" + root_child0_child0_child0_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1.getComputedTop(), "0 === root_child0_child0_child0_child0_child1.getComputedTop() (" + root_child0_child0_child0_child0_child1.getComputedTop() + ")"); - console.assert(72 === root_child0_child0_child0_child0_child1.getComputedWidth(), "72 === root_child0_child0_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child0_child0_child1.getComputedWidth() + ")"); - console.assert(39 === root_child0_child0_child0_child0_child1.getComputedHeight(), "39 === root_child0_child0_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child0_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child1.getComputedLeft()).toBe(816); + expect(root_child0_child0_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child0_child0_child1.getComputedWidth()).toBe(72); + expect(root_child0_child0_child0_child0_child1.getComputedHeight()).toBe(39); - console.assert(36 === root_child0_child0_child0_child0_child1_child0.getComputedLeft(), "36 === root_child0_child0_child0_child0_child1_child0.getComputedLeft() (" + root_child0_child0_child0_child0_child1_child0.getComputedLeft() + ")"); - console.assert(21 === root_child0_child0_child0_child0_child1_child0.getComputedTop(), "21 === root_child0_child0_child0_child0_child1_child0.getComputedTop() (" + root_child0_child0_child0_child0_child1_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1_child0.getComputedWidth(), "0 === root_child0_child0_child0_child0_child1_child0.getComputedWidth() (" + root_child0_child0_child0_child0_child1_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1_child0.getComputedHeight(), "0 === root_child0_child0_child0_child0_child1_child0.getComputedHeight() (" + root_child0_child0_child0_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child1_child0.getComputedLeft()).toBe(36); + expect(root_child0_child0_child0_child0_child1_child0.getComputedTop()).toBe(21); + expect(root_child0_child0_child0_child0_child1_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0_child0_child0_child1_child0.getComputedHeight()).toBe(0); - console.assert(36 === root_child0_child0_child0_child0_child1_child1.getComputedLeft(), "36 === root_child0_child0_child0_child0_child1_child1.getComputedLeft() (" + root_child0_child0_child0_child0_child1_child1.getComputedLeft() + ")"); - console.assert(21 === root_child0_child0_child0_child0_child1_child1.getComputedTop(), "21 === root_child0_child0_child0_child0_child1_child1.getComputedTop() (" + root_child0_child0_child0_child0_child1_child1.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1_child1.getComputedWidth(), "0 === root_child0_child0_child0_child0_child1_child1.getComputedWidth() (" + root_child0_child0_child0_child0_child1_child1.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child0_child0_child1_child1.getComputedHeight(), "0 === root_child0_child0_child0_child0_child1_child1.getComputedHeight() (" + root_child0_child0_child0_child0_child1_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child0_child0_child1_child1.getComputedLeft()).toBe(36); + expect(root_child0_child0_child0_child0_child1_child1.getComputedTop()).toBe(21); + expect(root_child0_child0_child0_child0_child1_child1.getComputedWidth()).toBe(0); + expect(root_child0_child0_child0_child0_child1_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0_child1.getComputedLeft(), "0 === root_child0_child0_child1.getComputedLeft() (" + root_child0_child0_child1.getComputedLeft() + ")"); - console.assert(144 === root_child0_child0_child1.getComputedTop(), "144 === root_child0_child0_child1.getComputedTop() (" + root_child0_child0_child1.getComputedTop() + ")"); - console.assert(1080 === root_child0_child0_child1.getComputedWidth(), "1080 === root_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child1.getComputedWidth() + ")"); - console.assert(96 === root_child0_child0_child1.getComputedHeight(), "96 === root_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(144); + expect(root_child0_child0_child1.getComputedWidth()).toBe(1080); + expect(root_child0_child0_child1.getComputedHeight()).toBe(96); - console.assert(0 === root_child0_child0_child1_child0.getComputedLeft(), "0 === root_child0_child0_child1_child0.getComputedLeft() (" + root_child0_child0_child1_child0.getComputedLeft() + ")"); - console.assert(24 === root_child0_child0_child1_child0.getComputedTop(), "24 === root_child0_child0_child1_child0.getComputedTop() (" + root_child0_child0_child1_child0.getComputedTop() + ")"); - console.assert(906 === root_child0_child0_child1_child0.getComputedWidth(), "906 === root_child0_child0_child1_child0.getComputedWidth() (" + root_child0_child0_child1_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0_child1_child0.getComputedHeight(), "72 === root_child0_child0_child1_child0.getComputedHeight() (" + root_child0_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1_child0.getComputedTop()).toBe(24); + expect(root_child0_child0_child1_child0.getComputedWidth()).toBe(906); + expect(root_child0_child0_child1_child0.getComputedHeight()).toBe(72); - console.assert(834 === root_child0_child0_child1_child0_child0.getComputedLeft(), "834 === root_child0_child0_child1_child0_child0.getComputedLeft() (" + root_child0_child0_child1_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child0.getComputedTop(), "0 === root_child0_child0_child1_child0_child0.getComputedTop() (" + root_child0_child0_child1_child0_child0.getComputedTop() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child0.getComputedWidth(), "72 === root_child0_child0_child1_child0_child0.getComputedWidth() (" + root_child0_child0_child1_child0_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child0.getComputedHeight(), "72 === root_child0_child0_child1_child0_child0.getComputedHeight() (" + root_child0_child0_child1_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child0.getComputedLeft()).toBe(834); + expect(root_child0_child0_child1_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child1_child0_child0.getComputedWidth()).toBe(72); + expect(root_child0_child0_child1_child0_child0.getComputedHeight()).toBe(72); - console.assert(0 === root_child0_child0_child1_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child1_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child1_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child1_child0_child0_child0.getComputedTop() (" + root_child0_child0_child1_child0_child0_child0.getComputedTop() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child0_child0.getComputedWidth(), "72 === root_child0_child0_child1_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child1_child0_child0_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child0_child0.getComputedHeight(), "72 === root_child0_child0_child1_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child1_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child1_child0_child0_child0.getComputedWidth()).toBe(72); + expect(root_child0_child0_child1_child0_child0_child0.getComputedHeight()).toBe(72); - console.assert(726 === root_child0_child0_child1_child0_child1.getComputedLeft(), "726 === root_child0_child0_child1_child0_child1.getComputedLeft() (" + root_child0_child0_child1_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1.getComputedTop(), "0 === root_child0_child0_child1_child0_child1.getComputedTop() (" + root_child0_child0_child1_child0_child1.getComputedTop() + ")"); - console.assert(72 === root_child0_child0_child1_child0_child1.getComputedWidth(), "72 === root_child0_child0_child1_child0_child1.getComputedWidth() (" + root_child0_child0_child1_child0_child1.getComputedWidth() + ")"); - console.assert(39 === root_child0_child0_child1_child0_child1.getComputedHeight(), "39 === root_child0_child0_child1_child0_child1.getComputedHeight() (" + root_child0_child0_child1_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child1.getComputedLeft()).toBe(726); + expect(root_child0_child0_child1_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1_child0_child1.getComputedWidth()).toBe(72); + expect(root_child0_child0_child1_child0_child1.getComputedHeight()).toBe(39); - console.assert(36 === root_child0_child0_child1_child0_child1_child0.getComputedLeft(), "36 === root_child0_child0_child1_child0_child1_child0.getComputedLeft() (" + root_child0_child0_child1_child0_child1_child0.getComputedLeft() + ")"); - console.assert(21 === root_child0_child0_child1_child0_child1_child0.getComputedTop(), "21 === root_child0_child0_child1_child0_child1_child0.getComputedTop() (" + root_child0_child0_child1_child0_child1_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1_child0.getComputedWidth(), "0 === root_child0_child0_child1_child0_child1_child0.getComputedWidth() (" + root_child0_child0_child1_child0_child1_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1_child0.getComputedHeight(), "0 === root_child0_child0_child1_child0_child1_child0.getComputedHeight() (" + root_child0_child0_child1_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child1_child0.getComputedLeft()).toBe(36); + expect(root_child0_child0_child1_child0_child1_child0.getComputedTop()).toBe(21); + expect(root_child0_child0_child1_child0_child1_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0_child1_child0_child1_child0.getComputedHeight()).toBe(0); - console.assert(36 === root_child0_child0_child1_child0_child1_child1.getComputedLeft(), "36 === root_child0_child0_child1_child0_child1_child1.getComputedLeft() (" + root_child0_child0_child1_child0_child1_child1.getComputedLeft() + ")"); - console.assert(21 === root_child0_child0_child1_child0_child1_child1.getComputedTop(), "21 === root_child0_child0_child1_child0_child1_child1.getComputedTop() (" + root_child0_child0_child1_child0_child1_child1.getComputedTop() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1_child1.getComputedWidth(), "0 === root_child0_child0_child1_child0_child1_child1.getComputedWidth() (" + root_child0_child0_child1_child0_child1_child1.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0_child1_child0_child1_child1.getComputedHeight(), "0 === root_child0_child0_child1_child0_child1_child1.getComputedHeight() (" + root_child0_child0_child1_child0_child1_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child1_child0_child1_child1.getComputedLeft()).toBe(36); + expect(root_child0_child0_child1_child0_child1_child1.getComputedTop()).toBe(21); + expect(root_child0_child0_child1_child0_child1_child1.getComputedWidth()).toBe(0); + expect(root_child0_child0_child1_child0_child1_child1.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGBorderTest.test.js b/javascript/tests/generated/YGBorderTest.test.js index 9f2e2034..74cf6b54 100644 --- a/javascript/tests/generated/YGBorderTest.test.js +++ b/javascript/tests/generated/YGBorderTest.test.js @@ -7,28 +7,28 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGBorderTest.html -it("border_no_size", function () { - var config = Yoga.Config.create(); +test("border_no_size", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setBorder(Yoga.EDGE_LEFT, 10); root.setBorder(Yoga.EDGE_TOP, 10); root.setBorder(Yoga.EDGE_RIGHT, 10); root.setBorder(Yoga.EDGE_BOTTOM, 10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(20); + expect(root.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(20); + expect(root.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -37,43 +37,43 @@ it("border_no_size", function () { config.free(); } }); -it("border_container_match_child", function () { - var config = Yoga.Config.create(); +test("border_container_match_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setBorder(Yoga.EDGE_LEFT, 10); root.setBorder(Yoga.EDGE_TOP, 10); root.setBorder(Yoga.EDGE_RIGHT, 10); root.setBorder(Yoga.EDGE_BOTTOM, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(30 === root.getComputedWidth(), "30 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(30 === root.getComputedHeight(), "30 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(30); + expect(root.getComputedHeight()).toBe(30); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(30 === root.getComputedWidth(), "30 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(30 === root.getComputedHeight(), "30 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(30); + expect(root.getComputedHeight()).toBe(30); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -82,11 +82,11 @@ it("border_container_match_child", function () { config.free(); } }); -it("border_flex_child", function () { - var config = Yoga.Config.create(); +test("border_flex_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setBorder(Yoga.EDGE_LEFT, 10); root.setBorder(Yoga.EDGE_TOP, 10); root.setBorder(Yoga.EDGE_RIGHT, 10); @@ -94,33 +94,33 @@ it("border_flex_child", function () { root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(80); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -129,11 +129,11 @@ it("border_flex_child", function () { config.free(); } }); -it("border_stretch_child", function () { - var config = Yoga.Config.create(); +test("border_stretch_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setBorder(Yoga.EDGE_LEFT, 10); root.setBorder(Yoga.EDGE_TOP, 10); root.setBorder(Yoga.EDGE_RIGHT, 10); @@ -141,32 +141,32 @@ it("border_stretch_child", function () { root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -175,11 +175,11 @@ it("border_stretch_child", function () { config.free(); } }); -it("border_center_child", function () { - var config = Yoga.Config.create(); +test("border_center_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setBorder(Yoga.EDGE_START, 10); @@ -188,33 +188,33 @@ it("border_center_child", function () { root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(35 === root_child0.getComputedTop(), "35 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(40); + expect(root_child0.getComputedTop()).toBe(35); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(35 === root_child0.getComputedTop(), "35 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(35); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGDimensionTest.test.js b/javascript/tests/generated/YGDimensionTest.test.js index 580e6f46..edf74109 100644 --- a/javascript/tests/generated/YGDimensionTest.test.js +++ b/javascript/tests/generated/YGDimensionTest.test.js @@ -7,39 +7,39 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGDimensionTest.html -it("wrap_child", function () { - var config = Yoga.Config.create(); +test("wrap_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -48,52 +48,52 @@ it("wrap_child", function () { config.free(); } }); -it("wrap_grandchild", function () { - var config = Yoga.Config.create(); +test("wrap_grandchild", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(100); root_child0_child0.setHeight(100); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGDisplayTest.test.js b/javascript/tests/generated/YGDisplayTest.test.js index 62bc100a..f1d50ff6 100644 --- a/javascript/tests/generated/YGDisplayTest.test.js +++ b/javascript/tests/generated/YGDisplayTest.test.js @@ -7,56 +7,56 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html -it("display_none", function () { - var config = Yoga.Config.create(); +test("display_none", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setDisplay(Yoga.DISPLAY_NONE); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -65,57 +65,57 @@ it("display_none", function () { config.free(); } }); -it("display_none_fixed_size", function () { - var config = Yoga.Config.create(); +test("display_none_fixed_size", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root_child1.setDisplay(Yoga.DISPLAY_NONE); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -124,16 +124,16 @@ it("display_none_fixed_size", function () { config.free(); } }); -it("display_none_with_margin", function () { - var config = Yoga.Config.create(); +test("display_none_with_margin", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, 10); root_child0.setMargin(Yoga.EDGE_TOP, 10); root_child0.setMargin(Yoga.EDGE_RIGHT, 10); @@ -143,42 +143,42 @@ it("display_none_with_margin", function () { root_child0.setDisplay(Yoga.DISPLAY_NONE); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -187,93 +187,93 @@ it("display_none_with_margin", function () { config.free(); } }); -it("display_none_with_child", function () { - var config = Yoga.Config.create(); +test("display_none_with_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root_child1.setDisplay(Yoga.DISPLAY_NONE); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexGrow(1); root_child1_child0.setFlexShrink(1); root_child1_child0.setFlexBasis("0%"); root_child1_child0.setWidth(20); root_child1.insertChild(root_child1_child0, 0); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(0 === root_child1_child0.getComputedWidth(), "0 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(0 === root_child1_child0.getComputedHeight(), "0 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(0); + expect(root_child1_child0.getComputedHeight()).toBe(0); - console.assert(50 === root_child2.getComputedLeft(), "50 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(50); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(0 === root_child1_child0.getComputedWidth(), "0 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(0 === root_child1_child0.getComputedHeight(), "0 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(0); + expect(root_child1_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -282,57 +282,57 @@ it("display_none_with_child", function () { config.free(); } }); -it("display_none_with_position", function () { - var config = Yoga.Config.create(); +test("display_none_with_position", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setPosition(Yoga.EDGE_TOP, 10); root_child1.setDisplay(Yoga.DISPLAY_NONE); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -341,15 +341,15 @@ it("display_none_with_position", function () { config.free(); } }); -it("display_none_with_position_absolute", function () { - var config = Yoga.Config.create(); +test("display_none_with_position_absolute", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setWidth(100); root_child0.setHeight(100); @@ -357,27 +357,27 @@ it("display_none_with_position_absolute", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGFlexDirectionTest.test.js b/javascript/tests/generated/YGFlexDirectionTest.test.js index f45f3ebf..291363d4 100644 --- a/javascript/tests/generated/YGFlexDirectionTest.test.js +++ b/javascript/tests/generated/YGFlexDirectionTest.test.js @@ -7,67 +7,67 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html -it("flex_direction_column_no_height", function () { - var config = Yoga.Config.create(); +test("flex_direction_column_no_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(30 === root.getComputedHeight(), "30 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(30); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(30 === root.getComputedHeight(), "30 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(30); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -76,68 +76,68 @@ it("flex_direction_column_no_height", function () { config.free(); } }); -it("flex_direction_row_no_width", function () { - var config = Yoga.Config.create(); +test("flex_direction_row_no_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(30 === root.getComputedWidth(), "30 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(30); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(10); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(30 === root.getComputedWidth(), "30 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(30); + expect(root.getComputedHeight()).toBe(100); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(10); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -146,68 +146,68 @@ it("flex_direction_row_no_width", function () { config.free(); } }); -it("flex_direction_column", function () { - var config = Yoga.Config.create(); +test("flex_direction_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -216,69 +216,69 @@ it("flex_direction_column", function () { config.free(); } }); -it("flex_direction_row", function () { - var config = Yoga.Config.create(); +test("flex_direction_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(10); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(80 === root_child1.getComputedLeft(), "80 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(80); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(70 === root_child2.getComputedLeft(), "70 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(70); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -287,69 +287,69 @@ it("flex_direction_row", function () { config.free(); } }); -it("flex_direction_column_reverse", function () { - var config = Yoga.Config.create(); +test("flex_direction_column_reverse", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN_REVERSE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(90 === root_child0.getComputedTop(), "90 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(90); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(80 === root_child1.getComputedTop(), "80 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(80); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(70 === root_child2.getComputedTop(), "70 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(70); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(90 === root_child0.getComputedTop(), "90 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(90); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(80 === root_child1.getComputedTop(), "80 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(80); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(70 === root_child2.getComputedTop(), "70 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(70); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -358,69 +358,69 @@ it("flex_direction_column_reverse", function () { config.free(); } }); -it("flex_direction_row_reverse", function () { - var config = Yoga.Config.create(); +test("flex_direction_row_reverse", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW_REVERSE); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(80 === root_child1.getComputedLeft(), "80 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(80); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(70 === root_child2.getComputedLeft(), "70 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(70); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(10); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGFlexTest.test.js b/javascript/tests/generated/YGFlexTest.test.js index 8898db29..c3368ee1 100644 --- a/javascript/tests/generated/YGFlexTest.test.js +++ b/javascript/tests/generated/YGFlexTest.test.js @@ -7,55 +7,55 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGFlexTest.html -it("flex_basis_flex_grow_column", function () { - var config = Yoga.Config.create(); +test("flex_basis_flex_grow_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(75 === root_child0.getComputedHeight(), "75 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(75); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(75 === root_child1.getComputedTop(), "75 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(75); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(25); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(75 === root_child0.getComputedHeight(), "75 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(75); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(75 === root_child1.getComputedTop(), "75 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(75); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(25); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -64,59 +64,59 @@ it("flex_basis_flex_grow_column", function () { config.free(); } }); -it("flex_shrink_flex_grow_row", function () { - var config = Yoga.Config.create(); +test("flex_shrink_flex_grow_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(500); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setWidth(500); root_child0.setHeight(100); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexShrink(1); root_child1.setWidth(500); root_child1.setHeight(100); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(250 === root_child0.getComputedWidth(), "250 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(250); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(250 === root_child1.getComputedLeft(), "250 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(250 === root_child1.getComputedWidth(), "250 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(250); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(250); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(250 === root_child0.getComputedLeft(), "250 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(250 === root_child0.getComputedWidth(), "250 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(250); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(250); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(250 === root_child1.getComputedWidth(), "250 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(250); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -125,22 +125,22 @@ it("flex_shrink_flex_grow_row", function () { config.free(); } }); -it("flex_shrink_flex_grow_child_flex_shrink_other_child", function () { - var config = Yoga.Config.create(); +test("flex_shrink_flex_grow_child_flex_shrink_other_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(500); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setWidth(500); root_child0.setHeight(100); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setWidth(500); @@ -148,37 +148,37 @@ it("flex_shrink_flex_grow_child_flex_shrink_other_child", function () { root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(250 === root_child0.getComputedWidth(), "250 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(250); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(250 === root_child1.getComputedLeft(), "250 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(250 === root_child1.getComputedWidth(), "250 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(250); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(250); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(250 === root_child0.getComputedLeft(), "250 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(250 === root_child0.getComputedWidth(), "250 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(250); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(250); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(250 === root_child1.getComputedWidth(), "250 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(250); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -187,56 +187,56 @@ it("flex_shrink_flex_grow_child_flex_shrink_other_child", function () { config.free(); } }); -it("flex_basis_flex_grow_row", function () { - var config = Yoga.Config.create(); +test("flex_basis_flex_grow_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(75 === root_child0.getComputedWidth(), "75 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(75); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(25 === root_child1.getComputedWidth(), "25 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(25); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(25 === root_child0.getComputedLeft(), "25 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(75 === root_child0.getComputedWidth(), "75 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(25); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(75); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(25 === root_child1.getComputedWidth(), "25 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(25); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -245,55 +245,55 @@ it("flex_basis_flex_grow_row", function () { config.free(); } }); -it("flex_basis_flex_shrink_column", function () { - var config = Yoga.Config.create(); +test("flex_basis_flex_shrink_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setFlexBasis(100); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexBasis(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -302,56 +302,56 @@ it("flex_basis_flex_shrink_column", function () { config.free(); } }); -it("flex_basis_flex_shrink_row", function () { - var config = Yoga.Config.create(); +test("flex_basis_flex_shrink_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setFlexBasis(100); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexBasis(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -360,71 +360,71 @@ it("flex_basis_flex_shrink_row", function () { config.free(); } }); -it("flex_shrink_to_zero", function () { - var config = Yoga.Config.create(); +test("flex_shrink_to_zero", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setHeight(75); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexShrink(1); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(75 === root.getComputedHeight(), "75 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); + expect(root.getComputedHeight()).toBe(75); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(75 === root.getComputedHeight(), "75 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); + expect(root.getComputedHeight()).toBe(75); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -433,72 +433,72 @@ it("flex_shrink_to_zero", function () { config.free(); } }); -it("flex_basis_overrides_main_size", function () { - var config = Yoga.Config.create(); +test("flex_basis_overrides_main_size", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(80); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(80); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -507,54 +507,54 @@ it("flex_basis_overrides_main_size", function () { config.free(); } }); -it("flex_grow_shrink_at_most", function () { - var config = Yoga.Config.create(); +test("flex_grow_shrink_at_most", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexShrink(1); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -563,69 +563,69 @@ it("flex_grow_shrink_at_most", function () { config.free(); } }); -it("flex_grow_less_than_factor_one", function () { - var config = Yoga.Config.create(); +test("flex_grow_less_than_factor_one", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(0.2); root_child0.setFlexBasis(40); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(0.2); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(0.4); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(132 === root_child0.getComputedHeight(), "132 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(132); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(132 === root_child1.getComputedTop(), "132 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(92 === root_child1.getComputedHeight(), "92 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(132); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(92); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(224 === root_child2.getComputedTop(), "224 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(200 === root_child2.getComputedWidth(), "200 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(184 === root_child2.getComputedHeight(), "184 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(224); + expect(root_child2.getComputedWidth()).toBe(200); + expect(root_child2.getComputedHeight()).toBe(184); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(132 === root_child0.getComputedHeight(), "132 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(132); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(132 === root_child1.getComputedTop(), "132 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(92 === root_child1.getComputedHeight(), "92 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(132); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(92); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(224 === root_child2.getComputedTop(), "224 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(200 === root_child2.getComputedWidth(), "200 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(184 === root_child2.getComputedHeight(), "184 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(224); + expect(root_child2.getComputedWidth()).toBe(200); + expect(root_child2.getComputedHeight()).toBe(184); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGFlexWrapTest.test.js b/javascript/tests/generated/YGFlexWrapTest.test.js index bfa3f938..ba65302e 100644 --- a/javascript/tests/generated/YGFlexWrapTest.test.js +++ b/javascript/tests/generated/YGFlexWrapTest.test.js @@ -7,86 +7,86 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGFlexWrapTest.html -it("wrap_column", function () { - var config = Yoga.Config.create(); +test("wrap_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexWrap(Yoga.WRAP_WRAP); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(30); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(30); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(30); root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(60 === root.getComputedWidth(), "60 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(60); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(30 === root_child0.getComputedHeight(), "30 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(30); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(30); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(30); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(60 === root_child2.getComputedTop(), "60 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(60); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(30 === root_child3.getComputedLeft(), "30 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(30); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(30); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(60 === root.getComputedWidth(), "60 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(60); + expect(root.getComputedHeight()).toBe(100); - console.assert(30 === root_child0.getComputedLeft(), "30 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(30 === root_child0.getComputedHeight(), "30 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(30); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(30); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(30); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(30); - console.assert(30 === root_child2.getComputedLeft(), "30 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(60 === root_child2.getComputedTop(), "60 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(30); + expect(root_child2.getComputedTop()).toBe(60); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(30); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -95,87 +95,87 @@ it("wrap_column", function () { config.free(); } }); -it("wrap_row", function () { - var config = Yoga.Config.create(); +test("wrap_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(30); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(30); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(30); root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(60 === root.getComputedHeight(), "60 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(60); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(30 === root_child0.getComputedHeight(), "30 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(30); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(30); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(30); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(60 === root.getComputedHeight(), "60 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(60); - console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(30 === root_child0.getComputedHeight(), "30 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(70); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(30); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(30); - console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(70); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(30); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -184,88 +184,88 @@ it("wrap_row", function () { config.free(); } }); -it("wrap_row_align_items_flex_end", function () { - var config = Yoga.Config.create(); +test("wrap_row_align_items_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_FLEX_END); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(30); root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(60 === root.getComputedHeight(), "60 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(60); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(30); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(60 === root.getComputedHeight(), "60 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(60); - console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(70); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(70); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(30); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -274,88 +274,88 @@ it("wrap_row_align_items_flex_end", function () { config.free(); } }); -it("wrap_row_align_items_center", function () { - var config = Yoga.Config.create(); +test("wrap_row_align_items_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_CENTER); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(30); root.insertChild(root_child3, 3); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(60 === root.getComputedHeight(), "60 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(60); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(5 === root_child1.getComputedTop(), "5 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(5); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(30); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(60 === root.getComputedHeight(), "60 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(60); - console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(70); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(5 === root_child1.getComputedTop(), "5 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(5); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(30 === root_child3.getComputedTop(), "30 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(30 === root_child3.getComputedHeight(), "30 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(70); + expect(root_child3.getComputedTop()).toBe(30); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(30); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -364,59 +364,59 @@ it("wrap_row_align_items_center", function () { config.free(); } }); -it("flex_wrap_children_with_min_main_overriding_flex_basis", function () { - var config = Yoga.Config.create(); +test("flex_wrap_children_with_min_main_overriding_flex_basis", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexBasis(50); root_child0.setMinWidth(55); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexBasis(50); root_child1.setMinWidth(55); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(55 === root_child0.getComputedWidth(), "55 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(55); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(55 === root_child1.getComputedWidth(), "55 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(55); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(45 === root_child0.getComputedLeft(), "45 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(55 === root_child0.getComputedWidth(), "55 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(45); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(55); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(45 === root_child1.getComputedLeft(), "45 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(55 === root_child1.getComputedWidth(), "55 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(45); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(55); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -425,84 +425,84 @@ it("flex_wrap_children_with_min_main_overriding_flex_basis", function () { config.free(); } }); -it("flex_wrap_wrap_to_child_height", function () { - var config = Yoga.Config.create(); +test("flex_wrap_wrap_to_child_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setAlignItems(Yoga.ALIGN_FLEX_START); root_child0.setFlexWrap(Yoga.WRAP_WRAP); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(100); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(100); root_child0_child0_child0.setHeight(100); root_child0_child0.insertChild(root_child0_child0_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(100); root_child1.setHeight(100); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0_child0.getComputedWidth(), "100 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0_child0.getComputedHeight(), "100 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(100 === root_child1.getComputedTop(), "100 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(100); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0_child0.getComputedWidth(), "100 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0_child0.getComputedHeight(), "100 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(100 === root_child1.getComputedTop(), "100 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(100); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -511,56 +511,56 @@ it("flex_wrap_wrap_to_child_height", function () { config.free(); } }); -it("flex_wrap_align_stretch_fits_one_row", function () { - var config = Yoga.Config.create(); +test("flex_wrap_align_stretch_fits_one_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(150); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(150 === root.getComputedWidth(), "150 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(150); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -569,102 +569,102 @@ it("flex_wrap_align_stretch_fits_one_row", function () { config.free(); } }); -it("wrap_reverse_row_align_content_flex_start", function () { - var config = Yoga.Config.create(); +test("wrap_reverse_row_align_content_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(40); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(30); root_child4.setHeight(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(80); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(70); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(80); - console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(70); + expect(root_child0.getComputedTop()).toBe(70); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(70); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(40 === root_child4.getComputedLeft(), "40 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(40); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -673,103 +673,103 @@ it("wrap_reverse_row_align_content_flex_start", function () { config.free(); } }); -it("wrap_reverse_row_align_content_center", function () { - var config = Yoga.Config.create(); +test("wrap_reverse_row_align_content_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_CENTER); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(40); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(30); root_child4.setHeight(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(80); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(70); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(80); - console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(70); + expect(root_child0.getComputedTop()).toBe(70); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(70); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(40 === root_child4.getComputedLeft(), "40 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(40); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -778,102 +778,102 @@ it("wrap_reverse_row_align_content_center", function () { config.free(); } }); -it("wrap_reverse_row_single_line_different_size", function () { - var config = Yoga.Config.create(); +test("wrap_reverse_row_single_line_different_size", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(300); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(40); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(30); root_child4.setHeight(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(300 === root.getComputedWidth(), "300 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(300); + expect(root.getComputedHeight()).toBe(50); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(40 === root_child0.getComputedTop(), "40 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(40); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(30); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(90 === root_child3.getComputedLeft(), "90 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(90); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(120 === root_child4.getComputedLeft(), "120 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(120); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(300 === root.getComputedWidth(), "300 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(300); + expect(root.getComputedHeight()).toBe(50); - console.assert(270 === root_child0.getComputedLeft(), "270 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(40 === root_child0.getComputedTop(), "40 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(270); + expect(root_child0.getComputedTop()).toBe(40); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(240 === root_child1.getComputedLeft(), "240 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(240); + expect(root_child1.getComputedTop()).toBe(30); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(210 === root_child2.getComputedLeft(), "210 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(210); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(180 === root_child3.getComputedLeft(), "180 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(180); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(150 === root_child4.getComputedLeft(), "150 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(150); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -882,103 +882,103 @@ it("wrap_reverse_row_single_line_different_size", function () { config.free(); } }); -it("wrap_reverse_row_align_content_stretch", function () { - var config = Yoga.Config.create(); +test("wrap_reverse_row_align_content_stretch", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(40); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(30); root_child4.setHeight(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(80); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(70); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(80); - console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(70); + expect(root_child0.getComputedTop()).toBe(70); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(70); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(40 === root_child4.getComputedLeft(), "40 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(40); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -987,103 +987,103 @@ it("wrap_reverse_row_align_content_stretch", function () { config.free(); } }); -it("wrap_reverse_row_align_content_space_around", function () { - var config = Yoga.Config.create(); +test("wrap_reverse_row_align_content_space_around", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_SPACE_AROUND); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(40); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(30); root_child4.setHeight(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(80); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(70); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(80); - console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(70 === root_child0.getComputedTop(), "70 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(70); + expect(root_child0.getComputedTop()).toBe(70); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(60 === root_child1.getComputedTop(), "60 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(60); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(50 === root_child2.getComputedTop(), "50 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(50); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(70 === root_child3.getComputedLeft(), "70 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(10 === root_child3.getComputedTop(), "10 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(70); + expect(root_child3.getComputedTop()).toBe(10); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(40 === root_child4.getComputedLeft(), "40 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(40); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1092,103 +1092,103 @@ it("wrap_reverse_row_align_content_space_around", function () { config.free(); } }); -it("wrap_reverse_column_fixed_size", function () { - var config = Yoga.Config.create(); +test("wrap_reverse_column_fixed_size", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setFlexWrap(Yoga.WRAP_WRAP_REVERSE); root.setWidth(200); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(30); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(30); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(30); root_child2.setHeight(30); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(30); root_child3.setHeight(40); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(30); root_child4.setHeight(50); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(170 === root_child0.getComputedLeft(), "170 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(170); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(170 === root_child1.getComputedLeft(), "170 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(170); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(170 === root_child2.getComputedLeft(), "170 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(30 === root_child2.getComputedTop(), "30 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(170); + expect(root_child2.getComputedTop()).toBe(30); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(170 === root_child3.getComputedLeft(), "170 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(60 === root_child3.getComputedTop(), "60 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(170); + expect(root_child3.getComputedTop()).toBe(60); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(140 === root_child4.getComputedLeft(), "140 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(140); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(30 === root_child0.getComputedWidth(), "30 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(30); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(30 === root_child1.getComputedWidth(), "30 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(30); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(30 === root_child2.getComputedTop(), "30 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(30 === root_child2.getComputedWidth(), "30 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(30 === root_child2.getComputedHeight(), "30 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(30); + expect(root_child2.getComputedWidth()).toBe(30); + expect(root_child2.getComputedHeight()).toBe(30); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(60 === root_child3.getComputedTop(), "60 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(30 === root_child3.getComputedWidth(), "30 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(40 === root_child3.getComputedHeight(), "40 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(60); + expect(root_child3.getComputedWidth()).toBe(30); + expect(root_child3.getComputedHeight()).toBe(40); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(30 === root_child4.getComputedWidth(), "30 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(50 === root_child4.getComputedHeight(), "50 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(30); + expect(root_child4.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1197,72 +1197,72 @@ it("wrap_reverse_column_fixed_size", function () { config.free(); } }); -it("wrapped_row_within_align_items_center", function () { - var config = Yoga.Config.create(); +test("wrapped_row_within_align_items_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setFlexWrap(Yoga.WRAP_WRAP); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(150); root_child0_child0.setHeight(80); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(80); root_child0_child1.setHeight(80); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(160 === root_child0.getComputedHeight(), "160 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(160); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(150 === root_child0_child0.getComputedWidth(), "150 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0_child0.getComputedHeight(), "80 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(150); + expect(root_child0_child0.getComputedHeight()).toBe(80); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(80 === root_child0_child1.getComputedTop(), "80 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(80); + expect(root_child0_child1.getComputedWidth()).toBe(80); + expect(root_child0_child1.getComputedHeight()).toBe(80); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(160 === root_child0.getComputedHeight(), "160 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(160); - console.assert(50 === root_child0_child0.getComputedLeft(), "50 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(150 === root_child0_child0.getComputedWidth(), "150 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0_child0.getComputedHeight(), "80 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(150); + expect(root_child0_child0.getComputedHeight()).toBe(80); - console.assert(120 === root_child0_child1.getComputedLeft(), "120 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(80 === root_child0_child1.getComputedTop(), "80 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(120); + expect(root_child0_child1.getComputedTop()).toBe(80); + expect(root_child0_child1.getComputedWidth()).toBe(80); + expect(root_child0_child1.getComputedHeight()).toBe(80); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1271,72 +1271,72 @@ it("wrapped_row_within_align_items_center", function () { config.free(); } }); -it("wrapped_row_within_align_items_flex_start", function () { - var config = Yoga.Config.create(); +test("wrapped_row_within_align_items_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setFlexWrap(Yoga.WRAP_WRAP); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(150); root_child0_child0.setHeight(80); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(80); root_child0_child1.setHeight(80); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(160 === root_child0.getComputedHeight(), "160 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(160); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(150 === root_child0_child0.getComputedWidth(), "150 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0_child0.getComputedHeight(), "80 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(150); + expect(root_child0_child0.getComputedHeight()).toBe(80); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(80 === root_child0_child1.getComputedTop(), "80 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(80); + expect(root_child0_child1.getComputedWidth()).toBe(80); + expect(root_child0_child1.getComputedHeight()).toBe(80); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(160 === root_child0.getComputedHeight(), "160 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(160); - console.assert(50 === root_child0_child0.getComputedLeft(), "50 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(150 === root_child0_child0.getComputedWidth(), "150 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0_child0.getComputedHeight(), "80 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(150); + expect(root_child0_child0.getComputedHeight()).toBe(80); - console.assert(120 === root_child0_child1.getComputedLeft(), "120 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(80 === root_child0_child1.getComputedTop(), "80 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(120); + expect(root_child0_child1.getComputedTop()).toBe(80); + expect(root_child0_child1.getComputedWidth()).toBe(80); + expect(root_child0_child1.getComputedHeight()).toBe(80); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1345,72 +1345,72 @@ it("wrapped_row_within_align_items_flex_start", function () { config.free(); } }); -it("wrapped_row_within_align_items_flex_end", function () { - var config = Yoga.Config.create(); +test("wrapped_row_within_align_items_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_END); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setFlexWrap(Yoga.WRAP_WRAP); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(150); root_child0_child0.setHeight(80); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(80); root_child0_child1.setHeight(80); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(160 === root_child0.getComputedHeight(), "160 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(160); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(150 === root_child0_child0.getComputedWidth(), "150 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0_child0.getComputedHeight(), "80 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(150); + expect(root_child0_child0.getComputedHeight()).toBe(80); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(80 === root_child0_child1.getComputedTop(), "80 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(80); + expect(root_child0_child1.getComputedWidth()).toBe(80); + expect(root_child0_child1.getComputedHeight()).toBe(80); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(160 === root_child0.getComputedHeight(), "160 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(160); - console.assert(50 === root_child0_child0.getComputedLeft(), "50 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(150 === root_child0_child0.getComputedWidth(), "150 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0_child0.getComputedHeight(), "80 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(150); + expect(root_child0_child0.getComputedHeight()).toBe(80); - console.assert(120 === root_child0_child1.getComputedLeft(), "120 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(80 === root_child0_child1.getComputedTop(), "80 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(80 === root_child0_child1.getComputedWidth(), "80 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(80 === root_child0_child1.getComputedHeight(), "80 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(120); + expect(root_child0_child1.getComputedTop()).toBe(80); + expect(root_child0_child1.getComputedWidth()).toBe(80); + expect(root_child0_child1.getComputedHeight()).toBe(80); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1419,11 +1419,11 @@ it("wrapped_row_within_align_items_flex_end", function () { config.free(); } }); -it("wrapped_column_max_height", function () { - var config = Yoga.Config.create(); +test("wrapped_column_max_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignContent(Yoga.ALIGN_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -1431,13 +1431,13 @@ it("wrapped_column_max_height", function () { root.setWidth(700); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(500); root_child0.setMaxHeight(200); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setMargin(Yoga.EDGE_LEFT, 20); root_child1.setMargin(Yoga.EDGE_TOP, 20); root_child1.setMargin(Yoga.EDGE_RIGHT, 20); @@ -1446,53 +1446,53 @@ it("wrapped_column_max_height", function () { root_child1.setHeight(200); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(700 === root.getComputedWidth(), "700 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(700); + expect(root.getComputedHeight()).toBe(500); - console.assert(250 === root_child0.getComputedLeft(), "250 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(250); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(200 === root_child1.getComputedLeft(), "200 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(250 === root_child1.getComputedTop(), "250 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(200); + expect(root_child1.getComputedTop()).toBe(250); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(200); - console.assert(420 === root_child2.getComputedLeft(), "420 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(200 === root_child2.getComputedTop(), "200 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(420); + expect(root_child2.getComputedTop()).toBe(200); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(700 === root.getComputedWidth(), "700 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(700); + expect(root.getComputedHeight()).toBe(500); - console.assert(350 === root_child0.getComputedLeft(), "350 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(350); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(300 === root_child1.getComputedLeft(), "300 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(250 === root_child1.getComputedTop(), "250 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(300); + expect(root_child1.getComputedTop()).toBe(250); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(200); - console.assert(180 === root_child2.getComputedLeft(), "180 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(200 === root_child2.getComputedTop(), "200 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(180); + expect(root_child2.getComputedTop()).toBe(200); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1501,11 +1501,11 @@ it("wrapped_column_max_height", function () { config.free(); } }); -it("wrapped_column_max_height_flex", function () { - var config = Yoga.Config.create(); +test("wrapped_column_max_height_flex", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignContent(Yoga.ALIGN_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); @@ -1513,7 +1513,7 @@ it("wrapped_column_max_height_flex", function () { root.setWidth(700); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); @@ -1522,7 +1522,7 @@ it("wrapped_column_max_height_flex", function () { root_child0.setMaxHeight(200); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); @@ -1534,53 +1534,53 @@ it("wrapped_column_max_height_flex", function () { root_child1.setHeight(200); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root_child2.setHeight(100); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(700 === root.getComputedWidth(), "700 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(700); + expect(root.getComputedHeight()).toBe(500); - console.assert(300 === root_child0.getComputedLeft(), "300 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(180 === root_child0.getComputedHeight(), "180 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(300); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(180); - console.assert(250 === root_child1.getComputedLeft(), "250 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(200 === root_child1.getComputedTop(), "200 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(180 === root_child1.getComputedHeight(), "180 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(250); + expect(root_child1.getComputedTop()).toBe(200); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(180); - console.assert(300 === root_child2.getComputedLeft(), "300 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(400 === root_child2.getComputedTop(), "400 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(300); + expect(root_child2.getComputedTop()).toBe(400); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(700 === root.getComputedWidth(), "700 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(700); + expect(root.getComputedHeight()).toBe(500); - console.assert(300 === root_child0.getComputedLeft(), "300 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(180 === root_child0.getComputedHeight(), "180 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(300); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(180); - console.assert(250 === root_child1.getComputedLeft(), "250 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(200 === root_child1.getComputedTop(), "200 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(180 === root_child1.getComputedHeight(), "180 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(250); + expect(root_child1.getComputedTop()).toBe(200); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(180); - console.assert(300 === root_child2.getComputedLeft(), "300 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(400 === root_child2.getComputedTop(), "400 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(300); + expect(root_child2.getComputedTop()).toBe(400); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1589,99 +1589,99 @@ it("wrapped_column_max_height_flex", function () { config.free(); } }); -it("wrap_nodes_with_content_sizing_overflowing_margin", function () { - var config = Yoga.Config.create(); +test("wrap_nodes_with_content_sizing_overflowing_margin", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(500); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setFlexWrap(Yoga.WRAP_WRAP); root_child0.setWidth(85); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(40); root_child0_child0_child0.setHeight(40); root_child0_child0.insertChild(root_child0_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setMargin(Yoga.EDGE_RIGHT, 10); root_child0.insertChild(root_child0_child1, 1); - var root_child0_child1_child0 = Yoga.Node.create(config); + const root_child0_child1_child0 = Yoga.Node.create(config); root_child0_child1_child0.setWidth(40); root_child0_child1_child0.setHeight(40); root_child0_child1.insertChild(root_child0_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(85 === root_child0.getComputedWidth(), "85 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(85); + expect(root_child0.getComputedHeight()).toBe(80); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child0.getComputedWidth(), "40 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child0.getComputedHeight(), "40 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child0_child0.getComputedWidth(), "40 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child0_child0.getComputedHeight(), "40 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0_child0.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(40 === root_child0_child1.getComputedTop(), "40 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(40 === root_child0_child1.getComputedWidth(), "40 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(40 === root_child0_child1.getComputedHeight(), "40 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(40); + expect(root_child0_child1.getComputedWidth()).toBe(40); + expect(root_child0_child1.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child1_child0.getComputedLeft(), "0 === root_child0_child1_child0.getComputedLeft() (" + root_child0_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child1_child0.getComputedTop(), "0 === root_child0_child1_child0.getComputedTop() (" + root_child0_child1_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child1_child0.getComputedWidth(), "40 === root_child0_child1_child0.getComputedWidth() (" + root_child0_child1_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child1_child0.getComputedHeight(), "40 === root_child0_child1_child0.getComputedHeight() (" + root_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child1_child0.getComputedLeft()).toBe(0); + expect(root_child0_child1_child0.getComputedTop()).toBe(0); + expect(root_child0_child1_child0.getComputedWidth()).toBe(40); + expect(root_child0_child1_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(415 === root_child0.getComputedLeft(), "415 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(85 === root_child0.getComputedWidth(), "85 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(415); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(85); + expect(root_child0.getComputedHeight()).toBe(80); - console.assert(45 === root_child0_child0.getComputedLeft(), "45 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child0.getComputedWidth(), "40 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child0.getComputedHeight(), "40 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(45); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child0_child0.getComputedWidth(), "40 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child0_child0.getComputedHeight(), "40 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0_child0.getComputedHeight()).toBe(40); - console.assert(35 === root_child0_child1.getComputedLeft(), "35 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(40 === root_child0_child1.getComputedTop(), "40 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(40 === root_child0_child1.getComputedWidth(), "40 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(40 === root_child0_child1.getComputedHeight(), "40 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(35); + expect(root_child0_child1.getComputedTop()).toBe(40); + expect(root_child0_child1.getComputedWidth()).toBe(40); + expect(root_child0_child1.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child1_child0.getComputedLeft(), "0 === root_child0_child1_child0.getComputedLeft() (" + root_child0_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child1_child0.getComputedTop(), "0 === root_child0_child1_child0.getComputedTop() (" + root_child0_child1_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child1_child0.getComputedWidth(), "40 === root_child0_child1_child0.getComputedWidth() (" + root_child0_child1_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child1_child0.getComputedHeight(), "40 === root_child0_child1_child0.getComputedHeight() (" + root_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child1_child0.getComputedLeft()).toBe(0); + expect(root_child0_child1_child0.getComputedTop()).toBe(0); + expect(root_child0_child1_child0.getComputedWidth()).toBe(40); + expect(root_child0_child1_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1690,99 +1690,99 @@ it("wrap_nodes_with_content_sizing_overflowing_margin", function () { config.free(); } }); -it("wrap_nodes_with_content_sizing_margin_cross", function () { - var config = Yoga.Config.create(); +test("wrap_nodes_with_content_sizing_margin_cross", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(500); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setFlexWrap(Yoga.WRAP_WRAP); root_child0.setWidth(70); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(40); root_child0_child0_child0.setHeight(40); root_child0_child0.insertChild(root_child0_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setMargin(Yoga.EDGE_TOP, 10); root_child0.insertChild(root_child0_child1, 1); - var root_child0_child1_child0 = Yoga.Node.create(config); + const root_child0_child1_child0 = Yoga.Node.create(config); root_child0_child1_child0.setWidth(40); root_child0_child1_child0.setHeight(40); root_child0_child1.insertChild(root_child0_child1_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(70 === root_child0.getComputedWidth(), "70 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(90 === root_child0.getComputedHeight(), "90 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(70); + expect(root_child0.getComputedHeight()).toBe(90); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child0.getComputedWidth(), "40 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child0.getComputedHeight(), "40 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child0_child0.getComputedWidth(), "40 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child0_child0.getComputedHeight(), "40 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0_child0.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(50 === root_child0_child1.getComputedTop(), "50 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(40 === root_child0_child1.getComputedWidth(), "40 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(40 === root_child0_child1.getComputedHeight(), "40 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child1.getComputedWidth()).toBe(40); + expect(root_child0_child1.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child1_child0.getComputedLeft(), "0 === root_child0_child1_child0.getComputedLeft() (" + root_child0_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child1_child0.getComputedTop(), "0 === root_child0_child1_child0.getComputedTop() (" + root_child0_child1_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child1_child0.getComputedWidth(), "40 === root_child0_child1_child0.getComputedWidth() (" + root_child0_child1_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child1_child0.getComputedHeight(), "40 === root_child0_child1_child0.getComputedHeight() (" + root_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child1_child0.getComputedLeft()).toBe(0); + expect(root_child0_child1_child0.getComputedTop()).toBe(0); + expect(root_child0_child1_child0.getComputedWidth()).toBe(40); + expect(root_child0_child1_child0.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(430 === root_child0.getComputedLeft(), "430 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(70 === root_child0.getComputedWidth(), "70 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(90 === root_child0.getComputedHeight(), "90 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(430); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(70); + expect(root_child0.getComputedHeight()).toBe(90); - console.assert(30 === root_child0_child0.getComputedLeft(), "30 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child0.getComputedWidth(), "40 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child0.getComputedHeight(), "40 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(30); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child0_child0.getComputedWidth(), "40 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child0_child0.getComputedHeight(), "40 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(40); + expect(root_child0_child0_child0.getComputedHeight()).toBe(40); - console.assert(30 === root_child0_child1.getComputedLeft(), "30 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(50 === root_child0_child1.getComputedTop(), "50 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(40 === root_child0_child1.getComputedWidth(), "40 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(40 === root_child0_child1.getComputedHeight(), "40 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(30); + expect(root_child0_child1.getComputedTop()).toBe(50); + expect(root_child0_child1.getComputedWidth()).toBe(40); + expect(root_child0_child1.getComputedHeight()).toBe(40); - console.assert(0 === root_child0_child1_child0.getComputedLeft(), "0 === root_child0_child1_child0.getComputedLeft() (" + root_child0_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child1_child0.getComputedTop(), "0 === root_child0_child1_child0.getComputedTop() (" + root_child0_child1_child0.getComputedTop() + ")"); - console.assert(40 === root_child0_child1_child0.getComputedWidth(), "40 === root_child0_child1_child0.getComputedWidth() (" + root_child0_child1_child0.getComputedWidth() + ")"); - console.assert(40 === root_child0_child1_child0.getComputedHeight(), "40 === root_child0_child1_child0.getComputedHeight() (" + root_child0_child1_child0.getComputedHeight() + ")"); + expect(root_child0_child1_child0.getComputedLeft()).toBe(0); + expect(root_child0_child1_child0.getComputedTop()).toBe(0); + expect(root_child0_child1_child0.getComputedWidth()).toBe(40); + expect(root_child0_child1_child0.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGGapTest.test.js b/javascript/tests/generated/YGGapTest.test.js index c178f66a..242e317f 100644 --- a/javascript/tests/generated/YGGapTest.test.js +++ b/javascript/tests/generated/YGGapTest.test.js @@ -7,77 +7,77 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGGapTest.html -it("column_gap_flexible", function () { - var config = Yoga.Config.create(); +test("column_gap_flexible", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(80); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(60 === root_child0.getComputedLeft(), "60 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(60); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -86,70 +86,70 @@ it("column_gap_flexible", function () { config.free(); } }); -it("column_gap_inflexible", function () { - var config = Yoga.Config.create(); +test("column_gap_inflexible", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(80); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(60 === root_child0.getComputedLeft(), "60 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(60); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -158,72 +158,72 @@ it("column_gap_inflexible", function () { config.free(); } }); -it("column_gap_mixed_flexible", function () { - var config = Yoga.Config.create(); +test("column_gap_mixed_flexible", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(80); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(60 === root_child0.getComputedLeft(), "60 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(60); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -232,17 +232,17 @@ it("column_gap_mixed_flexible", function () { config.free(); } }); -it("column_gap_child_margins", function () { - var config = Yoga.Config.create(); +test("column_gap_child_margins", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(80); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); @@ -250,7 +250,7 @@ it("column_gap_child_margins", function () { root_child0.setMargin(Yoga.EDGE_RIGHT, 2); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); @@ -258,7 +258,7 @@ it("column_gap_child_margins", function () { root_child1.setMargin(Yoga.EDGE_RIGHT, 10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); @@ -267,47 +267,47 @@ it("column_gap_child_margins", function () { root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(2 === root_child0.getComputedLeft(), "2 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(2 === root_child0.getComputedWidth(), "2 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(2); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(2); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(26 === root_child1.getComputedLeft(), "26 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(2 === root_child1.getComputedWidth(), "2 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(26); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(2); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(63 === root_child2.getComputedLeft(), "63 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(2 === root_child2.getComputedWidth(), "2 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(63); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(2); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(76 === root_child0.getComputedLeft(), "76 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(2 === root_child0.getComputedWidth(), "2 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(76); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(2); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(52 === root_child1.getComputedLeft(), "52 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(2 === root_child1.getComputedWidth(), "2 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(52); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(2); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(15 === root_child2.getComputedLeft(), "15 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(2 === root_child2.getComputedWidth(), "2 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(15); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(2); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -316,164 +316,164 @@ it("column_gap_child_margins", function () { config.free(); } }); -it("column_row_gap_wrapping", function () { - var config = Yoga.Config.create(); +test("column_row_gap_wrapping", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(80); root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); - var root_child5 = Yoga.Node.create(config); + const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); - var root_child6 = Yoga.Node.create(config); + const root_child6 = Yoga.Node.create(config); root_child6.setWidth(20); root_child6.setHeight(20); root.insertChild(root_child6, 6); - var root_child7 = Yoga.Node.create(config); + const root_child7 = Yoga.Node.create(config); root_child7.setWidth(20); root_child7.setHeight(20); root.insertChild(root_child7, 7); - var root_child8 = Yoga.Node.create(config); + const root_child8 = Yoga.Node.create(config); root_child8.setWidth(20); root_child8.setHeight(20); root.insertChild(root_child8, 8); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(40 === root_child3.getComputedTop(), "40 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(40); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(40); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(60 === root_child5.getComputedLeft(), "60 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(40 === root_child5.getComputedTop(), "40 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(60); + expect(root_child5.getComputedTop()).toBe(40); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); - console.assert(0 === root_child6.getComputedLeft(), "0 === root_child6.getComputedLeft() (" + root_child6.getComputedLeft() + ")"); - console.assert(80 === root_child6.getComputedTop(), "80 === root_child6.getComputedTop() (" + root_child6.getComputedTop() + ")"); - console.assert(20 === root_child6.getComputedWidth(), "20 === root_child6.getComputedWidth() (" + root_child6.getComputedWidth() + ")"); - console.assert(20 === root_child6.getComputedHeight(), "20 === root_child6.getComputedHeight() (" + root_child6.getComputedHeight() + ")"); + expect(root_child6.getComputedLeft()).toBe(0); + expect(root_child6.getComputedTop()).toBe(80); + expect(root_child6.getComputedWidth()).toBe(20); + expect(root_child6.getComputedHeight()).toBe(20); - console.assert(30 === root_child7.getComputedLeft(), "30 === root_child7.getComputedLeft() (" + root_child7.getComputedLeft() + ")"); - console.assert(80 === root_child7.getComputedTop(), "80 === root_child7.getComputedTop() (" + root_child7.getComputedTop() + ")"); - console.assert(20 === root_child7.getComputedWidth(), "20 === root_child7.getComputedWidth() (" + root_child7.getComputedWidth() + ")"); - console.assert(20 === root_child7.getComputedHeight(), "20 === root_child7.getComputedHeight() (" + root_child7.getComputedHeight() + ")"); + expect(root_child7.getComputedLeft()).toBe(30); + expect(root_child7.getComputedTop()).toBe(80); + expect(root_child7.getComputedWidth()).toBe(20); + expect(root_child7.getComputedHeight()).toBe(20); - console.assert(60 === root_child8.getComputedLeft(), "60 === root_child8.getComputedLeft() (" + root_child8.getComputedLeft() + ")"); - console.assert(80 === root_child8.getComputedTop(), "80 === root_child8.getComputedTop() (" + root_child8.getComputedTop() + ")"); - console.assert(20 === root_child8.getComputedWidth(), "20 === root_child8.getComputedWidth() (" + root_child8.getComputedWidth() + ")"); - console.assert(20 === root_child8.getComputedHeight(), "20 === root_child8.getComputedHeight() (" + root_child8.getComputedHeight() + ")"); + expect(root_child8.getComputedLeft()).toBe(60); + expect(root_child8.getComputedTop()).toBe(80); + expect(root_child8.getComputedWidth()).toBe(20); + expect(root_child8.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(100); - console.assert(60 === root_child0.getComputedLeft(), "60 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(60); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(60 === root_child3.getComputedLeft(), "60 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(40 === root_child3.getComputedTop(), "40 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(60); + expect(root_child3.getComputedTop()).toBe(40); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(40); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(0 === root_child5.getComputedLeft(), "0 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(40 === root_child5.getComputedTop(), "40 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(0); + expect(root_child5.getComputedTop()).toBe(40); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); - console.assert(60 === root_child6.getComputedLeft(), "60 === root_child6.getComputedLeft() (" + root_child6.getComputedLeft() + ")"); - console.assert(80 === root_child6.getComputedTop(), "80 === root_child6.getComputedTop() (" + root_child6.getComputedTop() + ")"); - console.assert(20 === root_child6.getComputedWidth(), "20 === root_child6.getComputedWidth() (" + root_child6.getComputedWidth() + ")"); - console.assert(20 === root_child6.getComputedHeight(), "20 === root_child6.getComputedHeight() (" + root_child6.getComputedHeight() + ")"); + expect(root_child6.getComputedLeft()).toBe(60); + expect(root_child6.getComputedTop()).toBe(80); + expect(root_child6.getComputedWidth()).toBe(20); + expect(root_child6.getComputedHeight()).toBe(20); - console.assert(30 === root_child7.getComputedLeft(), "30 === root_child7.getComputedLeft() (" + root_child7.getComputedLeft() + ")"); - console.assert(80 === root_child7.getComputedTop(), "80 === root_child7.getComputedTop() (" + root_child7.getComputedTop() + ")"); - console.assert(20 === root_child7.getComputedWidth(), "20 === root_child7.getComputedWidth() (" + root_child7.getComputedWidth() + ")"); - console.assert(20 === root_child7.getComputedHeight(), "20 === root_child7.getComputedHeight() (" + root_child7.getComputedHeight() + ")"); + expect(root_child7.getComputedLeft()).toBe(30); + expect(root_child7.getComputedTop()).toBe(80); + expect(root_child7.getComputedWidth()).toBe(20); + expect(root_child7.getComputedHeight()).toBe(20); - console.assert(0 === root_child8.getComputedLeft(), "0 === root_child8.getComputedLeft() (" + root_child8.getComputedLeft() + ")"); - console.assert(80 === root_child8.getComputedTop(), "80 === root_child8.getComputedTop() (" + root_child8.getComputedTop() + ")"); - console.assert(20 === root_child8.getComputedWidth(), "20 === root_child8.getComputedWidth() (" + root_child8.getComputedWidth() + ")"); - console.assert(20 === root_child8.getComputedHeight(), "20 === root_child8.getComputedHeight() (" + root_child8.getComputedHeight() + ")"); + expect(root_child8.getComputedLeft()).toBe(0); + expect(root_child8.getComputedTop()).toBe(80); + expect(root_child8.getComputedWidth()).toBe(20); + expect(root_child8.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -482,70 +482,70 @@ it("column_row_gap_wrapping", function () { config.free(); } }); -it("column_gap_justify_flex_start", function () { - var config = Yoga.Config.create(); +test("column_gap_justify_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -554,71 +554,71 @@ it("column_gap_justify_flex_start", function () { config.free(); } }); -it("column_gap_justify_center", function () { - var config = Yoga.Config.create(); +test("column_gap_justify_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(100); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(70 === root_child2.getComputedLeft(), "70 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(70); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(70 === root_child0.getComputedLeft(), "70 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(70); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(10 === root_child2.getComputedLeft(), "10 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(10); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -627,71 +627,71 @@ it("column_gap_justify_center", function () { config.free(); } }); -it("column_gap_justify_flex_end", function () { - var config = Yoga.Config.create(); +test("column_gap_justify_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setWidth(100); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(80); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(60 === root_child0.getComputedLeft(), "60 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(60); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -700,71 +700,71 @@ it("column_gap_justify_flex_end", function () { config.free(); } }); -it("column_gap_justify_space_between", function () { - var config = Yoga.Config.create(); +test("column_gap_justify_space_between", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN); root.setWidth(100); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(80); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -773,71 +773,71 @@ it("column_gap_justify_space_between", function () { config.free(); } }); -it("column_gap_justify_space_around", function () { - var config = Yoga.Config.create(); +test("column_gap_justify_space_around", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND); root.setWidth(100); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(3 === root_child0.getComputedLeft(), "3 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(3); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(77 === root_child2.getComputedLeft(), "77 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(77); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(77 === root_child0.getComputedLeft(), "77 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(77); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(3 === root_child2.getComputedLeft(), "3 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(3); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -846,71 +846,71 @@ it("column_gap_justify_space_around", function () { config.free(); } }); -it("column_gap_justify_space_evenly", function () { - var config = Yoga.Config.create(); +test("column_gap_justify_space_evenly", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY); root.setWidth(100); root.setHeight(100); root.setGap(Yoga.GUTTER_COLUMN, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(5); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(75 === root_child2.getComputedLeft(), "75 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(75); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(5 === root_child2.getComputedLeft(), "5 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(5); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -919,11 +919,11 @@ it("column_gap_justify_space_evenly", function () { config.free(); } }); -it("column_gap_wrap_align_flex_start", function () { - var config = Yoga.Config.create(); +test("column_gap_wrap_align_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); @@ -931,108 +931,108 @@ it("column_gap_wrap_align_flex_start", function () { root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); - var root_child5 = Yoga.Node.create(config); + const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(40 === root_child3.getComputedTop(), "40 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(40); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(40); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(60 === root_child5.getComputedLeft(), "60 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(40 === root_child5.getComputedTop(), "40 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(60); + expect(root_child5.getComputedTop()).toBe(40); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(80 === root_child3.getComputedLeft(), "80 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(40 === root_child3.getComputedTop(), "40 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(80); + expect(root_child3.getComputedTop()).toBe(40); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(40 === root_child4.getComputedTop(), "40 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(40); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(20 === root_child5.getComputedLeft(), "20 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(40 === root_child5.getComputedTop(), "40 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(20); + expect(root_child5.getComputedTop()).toBe(40); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1041,11 +1041,11 @@ it("column_gap_wrap_align_flex_start", function () { config.free(); } }); -it("column_gap_wrap_align_center", function () { - var config = Yoga.Config.create(); +test("column_gap_wrap_align_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_CENTER); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -1054,108 +1054,108 @@ it("column_gap_wrap_align_center", function () { root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); - var root_child5 = Yoga.Node.create(config); + const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(20 === root_child1.getComputedTop(), "20 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(20); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(60 === root_child3.getComputedTop(), "60 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(60); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(60 === root_child4.getComputedTop(), "60 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(60); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(60 === root_child5.getComputedLeft(), "60 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(60 === root_child5.getComputedTop(), "60 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(60); + expect(root_child5.getComputedTop()).toBe(60); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(20 === root_child1.getComputedTop(), "20 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(20); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(80 === root_child3.getComputedLeft(), "80 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(60 === root_child3.getComputedTop(), "60 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(80); + expect(root_child3.getComputedTop()).toBe(60); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(60 === root_child4.getComputedTop(), "60 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(60); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(20 === root_child5.getComputedLeft(), "20 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(60 === root_child5.getComputedTop(), "60 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(20); + expect(root_child5.getComputedTop()).toBe(60); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1164,11 +1164,11 @@ it("column_gap_wrap_align_center", function () { config.free(); } }); -it("column_gap_wrap_align_flex_end", function () { - var config = Yoga.Config.create(); +test("column_gap_wrap_align_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_FLEX_END); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -1177,108 +1177,108 @@ it("column_gap_wrap_align_flex_end", function () { root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); - var root_child5 = Yoga.Node.create(config); + const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(40 === root_child0.getComputedTop(), "40 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(40); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(40 === root_child2.getComputedTop(), "40 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(40); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(80); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(80 === root_child4.getComputedTop(), "80 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(80); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(60 === root_child5.getComputedLeft(), "60 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(80 === root_child5.getComputedTop(), "80 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(60); + expect(root_child5.getComputedTop()).toBe(80); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(40 === root_child0.getComputedTop(), "40 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(40); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(40 === root_child1.getComputedTop(), "40 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(40); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(40 === root_child2.getComputedTop(), "40 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(40); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(80 === root_child3.getComputedLeft(), "80 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(80); + expect(root_child3.getComputedTop()).toBe(80); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(80 === root_child4.getComputedTop(), "80 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(80); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(20 === root_child5.getComputedLeft(), "20 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(80 === root_child5.getComputedTop(), "80 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(20); + expect(root_child5.getComputedTop()).toBe(80); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1287,11 +1287,11 @@ it("column_gap_wrap_align_flex_end", function () { config.free(); } }); -it("column_gap_wrap_align_space_between", function () { - var config = Yoga.Config.create(); +test("column_gap_wrap_align_space_between", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_SPACE_BETWEEN); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -1300,108 +1300,108 @@ it("column_gap_wrap_align_space_between", function () { root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); - var root_child5 = Yoga.Node.create(config); + const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(80); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(80 === root_child4.getComputedTop(), "80 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(80); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(60 === root_child5.getComputedLeft(), "60 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(80 === root_child5.getComputedTop(), "80 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(60); + expect(root_child5.getComputedTop()).toBe(80); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(80 === root_child3.getComputedLeft(), "80 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(80 === root_child3.getComputedTop(), "80 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(80); + expect(root_child3.getComputedTop()).toBe(80); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(80 === root_child4.getComputedTop(), "80 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(80); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(20 === root_child5.getComputedLeft(), "20 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(80 === root_child5.getComputedTop(), "80 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(20); + expect(root_child5.getComputedTop()).toBe(80); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1410,11 +1410,11 @@ it("column_gap_wrap_align_space_between", function () { config.free(); } }); -it("column_gap_wrap_align_space_around", function () { - var config = Yoga.Config.create(); +test("column_gap_wrap_align_space_around", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_SPACE_AROUND); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -1423,108 +1423,108 @@ it("column_gap_wrap_align_space_around", function () { root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root_child1.setHeight(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root_child2.setHeight(20); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root_child3.setHeight(20); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root_child4.setHeight(20); root.insertChild(root_child4, 4); - var root_child5 = Yoga.Node.create(config); + const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root_child5.setHeight(20); root.insertChild(root_child5, 5); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(10 === root_child2.getComputedTop(), "10 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(10); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(70 === root_child3.getComputedTop(), "70 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(70); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(70 === root_child4.getComputedTop(), "70 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(70); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(60 === root_child5.getComputedLeft(), "60 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(70 === root_child5.getComputedTop(), "70 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(60); + expect(root_child5.getComputedTop()).toBe(70); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(20 === root_child1.getComputedHeight(), "20 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(20); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(10 === root_child2.getComputedTop(), "10 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(20 === root_child2.getComputedHeight(), "20 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(10); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(20); - console.assert(80 === root_child3.getComputedLeft(), "80 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(70 === root_child3.getComputedTop(), "70 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(20 === root_child3.getComputedHeight(), "20 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(80); + expect(root_child3.getComputedTop()).toBe(70); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(20); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(70 === root_child4.getComputedTop(), "70 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(20 === root_child4.getComputedHeight(), "20 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(70); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(20); - console.assert(20 === root_child5.getComputedLeft(), "20 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(70 === root_child5.getComputedTop(), "70 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(20 === root_child5.getComputedHeight(), "20 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(20); + expect(root_child5.getComputedTop()).toBe(70); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1533,11 +1533,11 @@ it("column_gap_wrap_align_space_around", function () { config.free(); } }); -it("column_gap_wrap_align_stretch", function () { - var config = Yoga.Config.create(); +test("column_gap_wrap_align_stretch", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -1545,93 +1545,93 @@ it("column_gap_wrap_align_stretch", function () { root.setHeight(300); root.setGap(Yoga.GUTTER_COLUMN, 5); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMinWidth(60); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setMinWidth(60); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setMinWidth(60); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setFlexGrow(1); root_child3.setMinWidth(60); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setFlexGrow(1); root_child4.setMinWidth(60); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(300 === root.getComputedWidth(), "300 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(300 === root.getComputedHeight(), "300 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(300); + expect(root.getComputedHeight()).toBe(300); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(71 === root_child0.getComputedWidth(), "71 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(150 === root_child0.getComputedHeight(), "150 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(71); + expect(root_child0.getComputedHeight()).toBe(150); - console.assert(76 === root_child1.getComputedLeft(), "76 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(72 === root_child1.getComputedWidth(), "72 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(76); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(72); + expect(root_child1.getComputedHeight()).toBe(150); - console.assert(153 === root_child2.getComputedLeft(), "153 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(71 === root_child2.getComputedWidth(), "71 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(150 === root_child2.getComputedHeight(), "150 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(153); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(71); + expect(root_child2.getComputedHeight()).toBe(150); - console.assert(229 === root_child3.getComputedLeft(), "229 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(71 === root_child3.getComputedWidth(), "71 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(150 === root_child3.getComputedHeight(), "150 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(229); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(71); + expect(root_child3.getComputedHeight()).toBe(150); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(150 === root_child4.getComputedTop(), "150 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(300 === root_child4.getComputedWidth(), "300 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(150 === root_child4.getComputedHeight(), "150 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(150); + expect(root_child4.getComputedWidth()).toBe(300); + expect(root_child4.getComputedHeight()).toBe(150); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(300 === root.getComputedWidth(), "300 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(300 === root.getComputedHeight(), "300 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(300); + expect(root.getComputedHeight()).toBe(300); - console.assert(229 === root_child0.getComputedLeft(), "229 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(71 === root_child0.getComputedWidth(), "71 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(150 === root_child0.getComputedHeight(), "150 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(229); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(71); + expect(root_child0.getComputedHeight()).toBe(150); - console.assert(153 === root_child1.getComputedLeft(), "153 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(71 === root_child1.getComputedWidth(), "71 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(153); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(71); + expect(root_child1.getComputedHeight()).toBe(150); - console.assert(76 === root_child2.getComputedLeft(), "76 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(72 === root_child2.getComputedWidth(), "72 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(150 === root_child2.getComputedHeight(), "150 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(76); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(72); + expect(root_child2.getComputedHeight()).toBe(150); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(71 === root_child3.getComputedWidth(), "71 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(150 === root_child3.getComputedHeight(), "150 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(71); + expect(root_child3.getComputedHeight()).toBe(150); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(150 === root_child4.getComputedTop(), "150 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(300 === root_child4.getComputedWidth(), "300 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(150 === root_child4.getComputedHeight(), "150 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(150); + expect(root_child4.getComputedWidth()).toBe(300); + expect(root_child4.getComputedHeight()).toBe(150); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1640,11 +1640,11 @@ it("column_gap_wrap_align_stretch", function () { config.free(); } }); -it("row_gap_align_items_stretch", function () { - var config = Yoga.Config.create(); +test("row_gap_align_items_stretch", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -1653,102 +1653,102 @@ it("row_gap_align_items_stretch", function () { root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root.insertChild(root_child4, 4); - var root_child5 = Yoga.Node.create(config); + const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root.insertChild(root_child5, 5); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(90 === root_child0.getComputedHeight(), "90 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(90); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(90 === root_child1.getComputedHeight(), "90 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(90); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(90 === root_child2.getComputedHeight(), "90 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(90); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(110 === root_child3.getComputedTop(), "110 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(90 === root_child3.getComputedHeight(), "90 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(110); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(90); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(110 === root_child4.getComputedTop(), "110 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(90 === root_child4.getComputedHeight(), "90 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(110); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(90); - console.assert(60 === root_child5.getComputedLeft(), "60 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(110 === root_child5.getComputedTop(), "110 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(90 === root_child5.getComputedHeight(), "90 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(60); + expect(root_child5.getComputedTop()).toBe(110); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(90); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(90 === root_child0.getComputedHeight(), "90 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(90); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(90 === root_child1.getComputedHeight(), "90 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(90); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(90 === root_child2.getComputedHeight(), "90 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(90); - console.assert(80 === root_child3.getComputedLeft(), "80 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(110 === root_child3.getComputedTop(), "110 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(90 === root_child3.getComputedHeight(), "90 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(80); + expect(root_child3.getComputedTop()).toBe(110); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(90); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(110 === root_child4.getComputedTop(), "110 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(90 === root_child4.getComputedHeight(), "90 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(110); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(90); - console.assert(20 === root_child5.getComputedLeft(), "20 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(110 === root_child5.getComputedTop(), "110 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(90 === root_child5.getComputedHeight(), "90 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(20); + expect(root_child5.getComputedTop()).toBe(110); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(90); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1757,11 +1757,11 @@ it("row_gap_align_items_stretch", function () { config.free(); } }); -it("row_gap_align_items_end", function () { - var config = Yoga.Config.create(); +test("row_gap_align_items_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_FLEX_END); root.setFlexWrap(Yoga.WRAP_WRAP); @@ -1770,102 +1770,102 @@ it("row_gap_align_items_end", function () { root.setGap(Yoga.GUTTER_COLUMN, 10); root.setGap(Yoga.GUTTER_ROW, 20); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(20); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(20); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setWidth(20); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setWidth(20); root.insertChild(root_child4, 4); - var root_child5 = Yoga.Node.create(config); + const root_child5 = Yoga.Node.create(config); root_child5.setWidth(20); root.insertChild(root_child5, 5); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(30 === root_child1.getComputedLeft(), "30 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(30); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(60 === root_child2.getComputedLeft(), "60 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(60); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(0); - console.assert(0 === root_child3.getComputedLeft(), "0 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(20 === root_child3.getComputedTop(), "20 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(0 === root_child3.getComputedHeight(), "0 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(0); + expect(root_child3.getComputedTop()).toBe(20); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(0); - console.assert(30 === root_child4.getComputedLeft(), "30 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(20 === root_child4.getComputedTop(), "20 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(30); + expect(root_child4.getComputedTop()).toBe(20); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(0); - console.assert(60 === root_child5.getComputedLeft(), "60 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(20 === root_child5.getComputedTop(), "20 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(0 === root_child5.getComputedHeight(), "0 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(60); + expect(root_child5.getComputedTop()).toBe(20); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(20 === root_child2.getComputedWidth(), "20 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(20); + expect(root_child2.getComputedHeight()).toBe(0); - console.assert(80 === root_child3.getComputedLeft(), "80 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(20 === root_child3.getComputedTop(), "20 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(20 === root_child3.getComputedWidth(), "20 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(0 === root_child3.getComputedHeight(), "0 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(80); + expect(root_child3.getComputedTop()).toBe(20); + expect(root_child3.getComputedWidth()).toBe(20); + expect(root_child3.getComputedHeight()).toBe(0); - console.assert(50 === root_child4.getComputedLeft(), "50 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(20 === root_child4.getComputedTop(), "20 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(20 === root_child4.getComputedWidth(), "20 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(0 === root_child4.getComputedHeight(), "0 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(50); + expect(root_child4.getComputedTop()).toBe(20); + expect(root_child4.getComputedWidth()).toBe(20); + expect(root_child4.getComputedHeight()).toBe(0); - console.assert(20 === root_child5.getComputedLeft(), "20 === root_child5.getComputedLeft() (" + root_child5.getComputedLeft() + ")"); - console.assert(20 === root_child5.getComputedTop(), "20 === root_child5.getComputedTop() (" + root_child5.getComputedTop() + ")"); - console.assert(20 === root_child5.getComputedWidth(), "20 === root_child5.getComputedWidth() (" + root_child5.getComputedWidth() + ")"); - console.assert(0 === root_child5.getComputedHeight(), "0 === root_child5.getComputedHeight() (" + root_child5.getComputedHeight() + ")"); + expect(root_child5.getComputedLeft()).toBe(20); + expect(root_child5.getComputedTop()).toBe(20); + expect(root_child5.getComputedWidth()).toBe(20); + expect(root_child5.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1874,16 +1874,16 @@ it("row_gap_align_items_end", function () { config.free(); } }); -it("row_gap_column_child_margins", function () { - var config = Yoga.Config.create(); +test("row_gap_column_child_margins", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(200); root.setGap(Yoga.GUTTER_ROW, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); @@ -1891,7 +1891,7 @@ it("row_gap_column_child_margins", function () { root_child0.setMargin(Yoga.EDGE_BOTTOM, 2); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexShrink(1); root_child1.setFlexBasis("0%"); @@ -1899,7 +1899,7 @@ it("row_gap_column_child_margins", function () { root_child1.setMargin(Yoga.EDGE_BOTTOM, 10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setFlexShrink(1); root_child2.setFlexBasis("0%"); @@ -1908,47 +1908,47 @@ it("row_gap_column_child_margins", function () { root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(2 === root_child0.getComputedTop(), "2 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(42 === root_child0.getComputedHeight(), "42 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(2); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(42); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(66 === root_child1.getComputedTop(), "66 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(42 === root_child1.getComputedHeight(), "42 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(66); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(42); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(143 === root_child2.getComputedTop(), "143 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(42 === root_child2.getComputedHeight(), "42 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(143); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(42); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(2 === root_child0.getComputedTop(), "2 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(42 === root_child0.getComputedHeight(), "42 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(2); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(42); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(66 === root_child1.getComputedTop(), "66 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(42 === root_child1.getComputedHeight(), "42 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(66); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(42); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(143 === root_child2.getComputedTop(), "143 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(42 === root_child2.getComputedHeight(), "42 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(143); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(42); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1957,77 +1957,77 @@ it("row_gap_column_child_margins", function () { config.free(); } }); -it("row_gap_row_wrap_child_margins", function () { - var config = Yoga.Config.create(); +test("row_gap_row_wrap_child_margins", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setFlexWrap(Yoga.WRAP_WRAP); root.setWidth(100); root.setHeight(200); root.setGap(Yoga.GUTTER_ROW, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, 2); root_child0.setMargin(Yoga.EDGE_BOTTOM, 2); root_child0.setWidth(60); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setMargin(Yoga.EDGE_TOP, 10); root_child1.setMargin(Yoga.EDGE_BOTTOM, 10); root_child1.setWidth(60); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setMargin(Yoga.EDGE_TOP, 15); root_child2.setMargin(Yoga.EDGE_BOTTOM, 15); root_child2.setWidth(60); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(2 === root_child0.getComputedTop(), "2 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(2); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(24 === root_child1.getComputedTop(), "24 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(60 === root_child1.getComputedWidth(), "60 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(24); + expect(root_child1.getComputedWidth()).toBe(60); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(59 === root_child2.getComputedTop(), "59 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(60 === root_child2.getComputedWidth(), "60 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(59); + expect(root_child2.getComputedWidth()).toBe(60); + expect(root_child2.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(200); - console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(2 === root_child0.getComputedTop(), "2 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(40); + expect(root_child0.getComputedTop()).toBe(2); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(24 === root_child1.getComputedTop(), "24 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(60 === root_child1.getComputedWidth(), "60 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(0 === root_child1.getComputedHeight(), "0 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(24); + expect(root_child1.getComputedWidth()).toBe(60); + expect(root_child1.getComputedHeight()).toBe(0); - console.assert(40 === root_child2.getComputedLeft(), "40 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(59 === root_child2.getComputedTop(), "59 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(60 === root_child2.getComputedWidth(), "60 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(0 === root_child2.getComputedHeight(), "0 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(40); + expect(root_child2.getComputedTop()).toBe(59); + expect(root_child2.getComputedWidth()).toBe(60); + expect(root_child2.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGJustifyContentTest.test.js b/javascript/tests/generated/YGJustifyContentTest.test.js index 89cc28a2..bb2c9721 100644 --- a/javascript/tests/generated/YGJustifyContentTest.test.js +++ b/javascript/tests/generated/YGJustifyContentTest.test.js @@ -7,69 +7,69 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGJustifyContentTest.html -it("justify_content_row_flex_start", function () { - var config = Yoga.Config.create(); +test("justify_content_row_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(10); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(20); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(92 === root_child0.getComputedLeft(), "92 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(92); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(82 === root_child1.getComputedLeft(), "82 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(82); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(72 === root_child2.getComputedLeft(), "72 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(72); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -78,70 +78,70 @@ it("justify_content_row_flex_start", function () { config.free(); } }); -it("justify_content_row_flex_end", function () { - var config = Yoga.Config.create(); +test("justify_content_row_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(72 === root_child0.getComputedLeft(), "72 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(72); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(82 === root_child1.getComputedLeft(), "82 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(82); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(92 === root_child2.getComputedLeft(), "92 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(92); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(10); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -150,70 +150,70 @@ it("justify_content_row_flex_end", function () { config.free(); } }); -it("justify_content_row_center", function () { - var config = Yoga.Config.create(); +test("justify_content_row_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(36 === root_child0.getComputedLeft(), "36 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(36); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(46 === root_child1.getComputedLeft(), "46 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(46); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(56 === root_child2.getComputedLeft(), "56 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(56); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(56 === root_child0.getComputedLeft(), "56 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(56); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(46 === root_child1.getComputedLeft(), "46 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(46); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(36 === root_child2.getComputedLeft(), "36 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(36); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -222,70 +222,70 @@ it("justify_content_row_center", function () { config.free(); } }); -it("justify_content_row_space_between", function () { - var config = Yoga.Config.create(); +test("justify_content_row_space_between", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(46 === root_child1.getComputedLeft(), "46 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(46); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(92 === root_child2.getComputedLeft(), "92 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(92); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(92 === root_child0.getComputedLeft(), "92 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(92); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(46 === root_child1.getComputedLeft(), "46 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(46); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -294,70 +294,70 @@ it("justify_content_row_space_between", function () { config.free(); } }); -it("justify_content_row_space_around", function () { - var config = Yoga.Config.create(); +test("justify_content_row_space_around", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(12 === root_child0.getComputedLeft(), "12 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(12); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(46 === root_child1.getComputedLeft(), "46 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(46); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(80 === root_child2.getComputedLeft(), "80 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(80); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(102 === root_child0.getComputedHeight(), "102 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(102); - console.assert(46 === root_child1.getComputedLeft(), "46 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(102 === root_child1.getComputedHeight(), "102 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(46); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(102); - console.assert(12 === root_child2.getComputedLeft(), "12 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(102 === root_child2.getComputedHeight(), "102 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(12); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(102); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -366,68 +366,68 @@ it("justify_content_row_space_around", function () { config.free(); } }); -it("justify_content_column_flex_start", function () { - var config = Yoga.Config.create(); +test("justify_content_column_flex_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(10); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(20); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -436,69 +436,69 @@ it("justify_content_column_flex_start", function () { config.free(); } }); -it("justify_content_column_flex_end", function () { - var config = Yoga.Config.create(); +test("justify_content_column_flex_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(72 === root_child0.getComputedTop(), "72 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(72); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(82 === root_child1.getComputedTop(), "82 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(82); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(92 === root_child2.getComputedTop(), "92 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(92); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(72 === root_child0.getComputedTop(), "72 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(72); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(82 === root_child1.getComputedTop(), "82 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(82); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(92 === root_child2.getComputedTop(), "92 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(92); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -507,69 +507,69 @@ it("justify_content_column_flex_end", function () { config.free(); } }); -it("justify_content_column_center", function () { - var config = Yoga.Config.create(); +test("justify_content_column_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(36 === root_child0.getComputedTop(), "36 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(36); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(46 === root_child1.getComputedTop(), "46 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(46); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(56 === root_child2.getComputedTop(), "56 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(56); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(36 === root_child0.getComputedTop(), "36 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(36); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(46 === root_child1.getComputedTop(), "46 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(46); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(56 === root_child2.getComputedTop(), "56 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(56); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -578,69 +578,69 @@ it("justify_content_column_center", function () { config.free(); } }); -it("justify_content_column_space_between", function () { - var config = Yoga.Config.create(); +test("justify_content_column_space_between", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_SPACE_BETWEEN); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(46 === root_child1.getComputedTop(), "46 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(46); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(92 === root_child2.getComputedTop(), "92 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(92); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(46 === root_child1.getComputedTop(), "46 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(46); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(92 === root_child2.getComputedTop(), "92 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(92); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -649,69 +649,69 @@ it("justify_content_column_space_between", function () { config.free(); } }); -it("justify_content_column_space_around", function () { - var config = Yoga.Config.create(); +test("justify_content_column_space_around", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_SPACE_AROUND); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(12 === root_child0.getComputedTop(), "12 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(12); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(46 === root_child1.getComputedTop(), "46 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(46); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(80); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(12 === root_child0.getComputedTop(), "12 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(12); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(46 === root_child1.getComputedTop(), "46 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(46); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(80); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -720,43 +720,43 @@ it("justify_content_column_space_around", function () { config.free(); } }); -it("justify_content_row_min_width_and_margin", function () { - var config = Yoga.Config.create(); +test("justify_content_row_min_width_and_margin", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setMargin(Yoga.EDGE_LEFT, 100); root.setMinWidth(50); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(100 === root.getComputedLeft(), "100 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(100); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); + expect(root.getComputedHeight()).toBe(20); - console.assert(15 === root_child0.getComputedLeft(), "15 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(15); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(100 === root.getComputedLeft(), "100 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(100); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); + expect(root.getComputedHeight()).toBe(20); - console.assert(15 === root_child0.getComputedLeft(), "15 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(15); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -765,44 +765,44 @@ it("justify_content_row_min_width_and_margin", function () { config.free(); } }); -it("justify_content_row_max_width_and_margin", function () { - var config = Yoga.Config.create(); +test("justify_content_row_max_width_and_margin", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setMargin(Yoga.EDGE_LEFT, 100); root.setWidth(100); root.setMaxWidth(80); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(100 === root.getComputedLeft(), "100 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(100); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(20); - console.assert(30 === root_child0.getComputedLeft(), "30 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(30); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(100 === root.getComputedLeft(), "100 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(80 === root.getComputedWidth(), "80 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(100); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(80); + expect(root.getComputedHeight()).toBe(20); - console.assert(30 === root_child0.getComputedLeft(), "30 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(30); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -811,42 +811,42 @@ it("justify_content_row_max_width_and_margin", function () { config.free(); } }); -it("justify_content_column_min_height_and_margin", function () { - var config = Yoga.Config.create(); +test("justify_content_column_min_height_and_margin", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setMargin(Yoga.EDGE_TOP, 100); root.setMinHeight(50); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(100 === root.getComputedTop(), "100 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(100); + expect(root.getComputedWidth()).toBe(20); + expect(root.getComputedHeight()).toBe(50); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(15 === root_child0.getComputedTop(), "15 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(15); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(100 === root.getComputedTop(), "100 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(100); + expect(root.getComputedWidth()).toBe(20); + expect(root.getComputedHeight()).toBe(50); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(15 === root_child0.getComputedTop(), "15 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(15); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -855,43 +855,43 @@ it("justify_content_column_min_height_and_margin", function () { config.free(); } }); -it("justify_content_colunn_max_height_and_margin", function () { - var config = Yoga.Config.create(); +test("justify_content_colunn_max_height_and_margin", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setMargin(Yoga.EDGE_TOP, 100); root.setHeight(100); root.setMaxHeight(80); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(20); root_child0.setHeight(20); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(100 === root.getComputedTop(), "100 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(100); + expect(root.getComputedWidth()).toBe(20); + expect(root.getComputedHeight()).toBe(80); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(100 === root.getComputedTop(), "100 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(80 === root.getComputedHeight(), "80 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(100); + expect(root.getComputedWidth()).toBe(20); + expect(root.getComputedHeight()).toBe(80); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(30 === root_child0.getComputedTop(), "30 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(30); + expect(root_child0.getComputedWidth()).toBe(20); + expect(root_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -900,69 +900,69 @@ it("justify_content_colunn_max_height_and_margin", function () { config.free(); } }); -it("justify_content_column_space_evenly", function () { - var config = Yoga.Config.create(); +test("justify_content_column_space_evenly", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(18 === root_child0.getComputedTop(), "18 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(18); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(46 === root_child1.getComputedTop(), "46 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(46); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(74 === root_child2.getComputedTop(), "74 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(74); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(18 === root_child0.getComputedTop(), "18 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(102 === root_child0.getComputedWidth(), "102 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(18); + expect(root_child0.getComputedWidth()).toBe(102); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(46 === root_child1.getComputedTop(), "46 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(102 === root_child1.getComputedWidth(), "102 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(46); + expect(root_child1.getComputedWidth()).toBe(102); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(74 === root_child2.getComputedTop(), "74 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(102 === root_child2.getComputedWidth(), "102 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(74); + expect(root_child2.getComputedWidth()).toBe(102); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -971,70 +971,70 @@ it("justify_content_column_space_evenly", function () { config.free(); } }); -it("justify_content_row_space_evenly", function () { - var config = Yoga.Config.create(); +test("justify_content_row_space_evenly", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_SPACE_EVENLY); root.setWidth(102); root.setHeight(102); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(26 === root_child0.getComputedLeft(), "26 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(26); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(51 === root_child1.getComputedLeft(), "51 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(51); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(77 === root_child2.getComputedLeft(), "77 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(0 === root_child2.getComputedWidth(), "0 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(77); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(0); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(102 === root.getComputedWidth(), "102 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(102 === root.getComputedHeight(), "102 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(102); + expect(root.getComputedHeight()).toBe(102); - console.assert(77 === root_child0.getComputedLeft(), "77 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(77); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(51 === root_child1.getComputedLeft(), "51 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(51); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(26 === root_child2.getComputedLeft(), "26 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(0 === root_child2.getComputedWidth(), "0 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(26); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(0); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1043,21 +1043,21 @@ it("justify_content_row_space_evenly", function () { config.free(); } }); -it("justify_content_min_width_with_padding_child_width_greater_than_parent", function () { - var config = Yoga.Config.create(); +test("justify_content_min_width_with_padding_child_width_greater_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setWidth(1000); root.setHeight(1584); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setAlignContent(Yoga.ALIGN_STRETCH); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0.setJustifyContent(Yoga.JUSTIFY_CENTER); root_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); @@ -1066,7 +1066,7 @@ it("justify_content_min_width_with_padding_child_width_greater_than_parent", fun root_child0_child0.setMinWidth(400); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child0.setWidth(300); @@ -1074,47 +1074,47 @@ it("justify_content_min_width_with_padding_child_width_greater_than_parent", fun root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(1000 === root.getComputedWidth(), "1000 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(1584 === root.getComputedHeight(), "1584 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(1000); + expect(root.getComputedHeight()).toBe(1584); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(1000 === root_child0.getComputedWidth(), "1000 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1000); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(500 === root_child0_child0.getComputedWidth(), "500 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(500); + expect(root_child0_child0.getComputedHeight()).toBe(100); - console.assert(100 === root_child0_child0_child0.getComputedLeft(), "100 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(300 === root_child0_child0_child0.getComputedWidth(), "300 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0_child0.getComputedHeight(), "100 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(100); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(300); + expect(root_child0_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(1000 === root.getComputedWidth(), "1000 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(1584 === root.getComputedHeight(), "1584 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(1000); + expect(root.getComputedHeight()).toBe(1584); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(1000 === root_child0.getComputedWidth(), "1000 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1000); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(500 === root_child0_child0.getComputedLeft(), "500 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(500 === root_child0_child0.getComputedWidth(), "500 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(500); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(500); + expect(root_child0_child0.getComputedHeight()).toBe(100); - console.assert(100 === root_child0_child0_child0.getComputedLeft(), "100 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(300 === root_child0_child0_child0.getComputedWidth(), "300 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0_child0.getComputedHeight(), "100 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(100); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(300); + expect(root_child0_child0_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1123,21 +1123,21 @@ it("justify_content_min_width_with_padding_child_width_greater_than_parent", fun config.free(); } }); -it("justify_content_min_width_with_padding_child_width_lower_than_parent", function () { - var config = Yoga.Config.create(); +test("justify_content_min_width_with_padding_child_width_lower_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignContent(Yoga.ALIGN_STRETCH); root.setWidth(1080); root.setHeight(1584); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setAlignContent(Yoga.ALIGN_STRETCH); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0.setJustifyContent(Yoga.JUSTIFY_CENTER); root_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); @@ -1146,7 +1146,7 @@ it("justify_content_min_width_with_padding_child_width_lower_than_parent", funct root_child0_child0.setMinWidth(400); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0_child0.setAlignContent(Yoga.ALIGN_STRETCH); root_child0_child0_child0.setWidth(199); @@ -1154,47 +1154,47 @@ it("justify_content_min_width_with_padding_child_width_lower_than_parent", funct root_child0_child0.insertChild(root_child0_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(1080 === root.getComputedWidth(), "1080 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(1584 === root.getComputedHeight(), "1584 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(1080); + expect(root.getComputedHeight()).toBe(1584); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(1080 === root_child0.getComputedWidth(), "1080 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1080); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(400 === root_child0_child0.getComputedWidth(), "400 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(400); + expect(root_child0_child0.getComputedHeight()).toBe(100); - console.assert(101 === root_child0_child0_child0.getComputedLeft(), "101 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(199 === root_child0_child0_child0.getComputedWidth(), "199 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0_child0.getComputedHeight(), "100 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(101); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(199); + expect(root_child0_child0_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(1080 === root.getComputedWidth(), "1080 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(1584 === root.getComputedHeight(), "1584 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(1080); + expect(root.getComputedHeight()).toBe(1584); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(1080 === root_child0.getComputedWidth(), "1080 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(1080); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(680 === root_child0_child0.getComputedLeft(), "680 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(400 === root_child0_child0.getComputedWidth(), "400 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(680); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(400); + expect(root_child0_child0.getComputedHeight()).toBe(100); - console.assert(101 === root_child0_child0_child0.getComputedLeft(), "101 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(199 === root_child0_child0_child0.getComputedWidth(), "199 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0_child0.getComputedHeight(), "100 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(101); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(199); + expect(root_child0_child0_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGMarginTest.test.js b/javascript/tests/generated/YGMarginTest.test.js index 46a8a25c..7f5ea2e5 100644 --- a/javascript/tests/generated/YGMarginTest.test.js +++ b/javascript/tests/generated/YGMarginTest.test.js @@ -7,42 +7,42 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGMarginTest.html -it("margin_start", function () { - var config = Yoga.Config.create(); +test("margin_start", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_START, 10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -51,41 +51,41 @@ it("margin_start", function () { config.free(); } }); -it("margin_top", function () { - var config = Yoga.Config.create(); +test("margin_top", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, 10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -94,43 +94,43 @@ it("margin_top", function () { config.free(); } }); -it("margin_end", function () { - var config = Yoga.Config.create(); +test("margin_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_END, 10); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -139,42 +139,42 @@ it("margin_end", function () { config.free(); } }); -it("margin_bottom", function () { - var config = Yoga.Config.create(); +test("margin_bottom", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_BOTTOM, 10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(80); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(80); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -183,43 +183,43 @@ it("margin_bottom", function () { config.free(); } }); -it("margin_and_flex_row", function () { - var config = Yoga.Config.create(); +test("margin_and_flex_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_START, 10); root_child0.setMargin(Yoga.EDGE_END, 10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -228,42 +228,42 @@ it("margin_and_flex_row", function () { config.free(); } }); -it("margin_and_flex_column", function () { - var config = Yoga.Config.create(); +test("margin_and_flex_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_TOP, 10); root_child0.setMargin(Yoga.EDGE_BOTTOM, 10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(80); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -272,43 +272,43 @@ it("margin_and_flex_column", function () { config.free(); } }); -it("margin_and_stretch_row", function () { - var config = Yoga.Config.create(); +test("margin_and_stretch_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_TOP, 10); root_child0.setMargin(Yoga.EDGE_BOTTOM, 10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(80); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -317,42 +317,42 @@ it("margin_and_stretch_row", function () { config.free(); } }); -it("margin_and_stretch_column", function () { - var config = Yoga.Config.create(); +test("margin_and_stretch_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_START, 10); root_child0.setMargin(Yoga.EDGE_END, 10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -361,56 +361,56 @@ it("margin_and_stretch_column", function () { config.free(); } }); -it("margin_with_sibling_row", function () { - var config = Yoga.Config.create(); +test("margin_with_sibling_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_END, 10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(45 === root_child0.getComputedWidth(), "45 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(45); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(55 === root_child1.getComputedLeft(), "55 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(45 === root_child1.getComputedWidth(), "45 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(55); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(45); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(55 === root_child0.getComputedLeft(), "55 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(45 === root_child0.getComputedWidth(), "45 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(55); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(45); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(45 === root_child1.getComputedWidth(), "45 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(45); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -419,55 +419,55 @@ it("margin_with_sibling_row", function () { config.free(); } }); -it("margin_with_sibling_column", function () { - var config = Yoga.Config.create(); +test("margin_with_sibling_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_BOTTOM, 10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(45 === root_child0.getComputedHeight(), "45 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(45); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(55 === root_child1.getComputedTop(), "55 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(45 === root_child1.getComputedHeight(), "45 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(55); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(45); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(45 === root_child0.getComputedHeight(), "45 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(45); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(55 === root_child1.getComputedTop(), "55 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(45 === root_child1.getComputedHeight(), "45 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(55); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(45); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -476,58 +476,58 @@ it("margin_with_sibling_column", function () { config.free(); } }); -it("margin_auto_bottom", function () { - var config = Yoga.Config.create(); +test("margin_auto_bottom", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_BOTTOM, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -536,58 +536,58 @@ it("margin_auto_bottom", function () { config.free(); } }); -it("margin_auto_top", function () { - var config = Yoga.Config.create(); +test("margin_auto_top", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(100 === root_child0.getComputedTop(), "100 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(100 === root_child0.getComputedTop(), "100 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -596,59 +596,59 @@ it("margin_auto_top", function () { config.free(); } }); -it("margin_auto_bottom_and_top", function () { - var config = Yoga.Config.create(); +test("margin_auto_bottom_and_top", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setMargin(Yoga.EDGE_BOTTOM, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(50); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(50); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -657,59 +657,59 @@ it("margin_auto_bottom_and_top", function () { config.free(); } }); -it("margin_auto_bottom_and_top_justify_center", function () { - var config = Yoga.Config.create(); +test("margin_auto_bottom_and_top_justify_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setMargin(Yoga.EDGE_BOTTOM, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(50); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(150 === root_child0.getComputedLeft(), "150 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(150); + expect(root_child0.getComputedTop()).toBe(50); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(150 === root_child1.getComputedLeft(), "150 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(150); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -718,74 +718,74 @@ it("margin_auto_bottom_and_top_justify_center", function () { config.free(); } }); -it("margin_auto_mutiple_children_column", function () { - var config = Yoga.Config.create(); +test("margin_auto_mutiple_children_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setMargin(Yoga.EDGE_TOP, "auto"); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(25 === root_child0.getComputedTop(), "25 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(25); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(100 === root_child1.getComputedTop(), "100 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(100); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(75 === root_child2.getComputedLeft(), "75 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(150 === root_child2.getComputedTop(), "150 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(75); + expect(root_child2.getComputedTop()).toBe(150); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(25 === root_child0.getComputedTop(), "25 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(25); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(100 === root_child1.getComputedTop(), "100 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(100); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(75 === root_child2.getComputedLeft(), "75 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(150 === root_child2.getComputedTop(), "150 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(75); + expect(root_child2.getComputedTop()).toBe(150); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -794,75 +794,75 @@ it("margin_auto_mutiple_children_column", function () { config.free(); } }); -it("margin_auto_mutiple_children_row", function () { - var config = Yoga.Config.create(); +test("margin_auto_mutiple_children_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(75); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(75 === root_child1.getComputedTop(), "75 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(75); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(150 === root_child2.getComputedLeft(), "150 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(75 === root_child2.getComputedTop(), "75 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(150); + expect(root_child2.getComputedTop()).toBe(75); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(125 === root_child0.getComputedLeft(), "125 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(125); + expect(root_child0.getComputedTop()).toBe(75); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(75 === root_child1.getComputedTop(), "75 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(75); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(75 === root_child2.getComputedTop(), "75 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(75); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -871,60 +871,60 @@ it("margin_auto_mutiple_children_row", function () { config.free(); } }); -it("margin_auto_left_and_right_column", function () { - var config = Yoga.Config.create(); +test("margin_auto_left_and_right_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(75); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(150 === root_child1.getComputedLeft(), "150 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(75 === root_child1.getComputedTop(), "75 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(150); + expect(root_child1.getComputedTop()).toBe(75); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(75); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(75 === root_child1.getComputedTop(), "75 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(75); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -933,58 +933,58 @@ it("margin_auto_left_and_right_column", function () { config.free(); } }); -it("margin_auto_left_and_right", function () { - var config = Yoga.Config.create(); +test("margin_auto_left_and_right", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(150 === root_child1.getComputedLeft(), "150 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(150); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -993,60 +993,60 @@ it("margin_auto_left_and_right", function () { config.free(); } }); -it("margin_auto_start_and_end_column", function () { - var config = Yoga.Config.create(); +test("margin_auto_start_and_end_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_START, "auto"); root_child0.setMargin(Yoga.EDGE_END, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(75); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(150 === root_child1.getComputedLeft(), "150 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(75 === root_child1.getComputedTop(), "75 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(150); + expect(root_child1.getComputedTop()).toBe(75); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(75); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(75 === root_child1.getComputedTop(), "75 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(75); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1055,58 +1055,58 @@ it("margin_auto_start_and_end_column", function () { config.free(); } }); -it("margin_auto_start_and_end", function () { - var config = Yoga.Config.create(); +test("margin_auto_start_and_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_START, "auto"); root_child0.setMargin(Yoga.EDGE_END, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(150 === root_child1.getComputedLeft(), "150 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(150); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1115,59 +1115,59 @@ it("margin_auto_start_and_end", function () { config.free(); } }); -it("margin_auto_left_and_right_column_and_center", function () { - var config = Yoga.Config.create(); +test("margin_auto_left_and_right_column_and_center", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1176,58 +1176,58 @@ it("margin_auto_left_and_right_column_and_center", function () { config.free(); } }); -it("margin_auto_left", function () { - var config = Yoga.Config.create(); +test("margin_auto_left", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(150 === root_child0.getComputedLeft(), "150 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(150); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(150 === root_child0.getComputedLeft(), "150 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(150); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1236,58 +1236,58 @@ it("margin_auto_left", function () { config.free(); } }); -it("margin_auto_right", function () { - var config = Yoga.Config.create(); +test("margin_auto_right", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1296,59 +1296,59 @@ it("margin_auto_right", function () { config.free(); } }); -it("margin_auto_left_and_right_stretch", function () { - var config = Yoga.Config.create(); +test("margin_auto_left_and_right_stretch", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(150 === root_child1.getComputedLeft(), "150 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(150); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1357,58 +1357,58 @@ it("margin_auto_left_and_right_stretch", function () { config.free(); } }); -it("margin_auto_top_and_bottom_stretch", function () { - var config = Yoga.Config.create(); +test("margin_auto_top_and_bottom_stretch", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root_child0.setMargin(Yoga.EDGE_BOTTOM, "auto"); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(50); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(150 === root_child0.getComputedLeft(), "150 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(50 === root_child0.getComputedTop(), "50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(150); + expect(root_child0.getComputedTop()).toBe(50); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(150 === root_child1.getComputedLeft(), "150 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(150); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1417,15 +1417,15 @@ it("margin_auto_top_and_bottom_stretch", function () { config.free(); } }); -it("margin_should_not_be_part_of_max_height", function () { - var config = Yoga.Config.create(); +test("margin_should_not_be_part_of_max_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(250); root.setHeight(250); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_TOP, 20); root_child0.setWidth(100); root_child0.setHeight(100); @@ -1433,27 +1433,27 @@ it("margin_should_not_be_part_of_max_height", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(250 === root.getComputedWidth(), "250 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(250 === root.getComputedHeight(), "250 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(250); + expect(root.getComputedHeight()).toBe(250); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(250 === root.getComputedWidth(), "250 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(250 === root.getComputedHeight(), "250 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(250); + expect(root.getComputedHeight()).toBe(250); - console.assert(150 === root_child0.getComputedLeft(), "150 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(150); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1462,15 +1462,15 @@ it("margin_should_not_be_part_of_max_height", function () { config.free(); } }); -it("margin_should_not_be_part_of_max_width", function () { - var config = Yoga.Config.create(); +test("margin_should_not_be_part_of_max_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(250); root.setHeight(250); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, 20); root_child0.setWidth(100); root_child0.setMaxWidth(100); @@ -1478,27 +1478,27 @@ it("margin_should_not_be_part_of_max_width", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(250 === root.getComputedWidth(), "250 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(250 === root.getComputedHeight(), "250 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(250); + expect(root.getComputedHeight()).toBe(250); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(250 === root.getComputedWidth(), "250 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(250 === root.getComputedHeight(), "250 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(250); + expect(root.getComputedHeight()).toBe(250); - console.assert(150 === root_child0.getComputedLeft(), "150 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(150); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1507,16 +1507,16 @@ it("margin_should_not_be_part_of_max_width", function () { config.free(); } }); -it("margin_auto_left_right_child_bigger_than_parent", function () { - var config = Yoga.Config.create(); +test("margin_auto_left_right_child_bigger_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(52); root.setHeight(52); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(72); @@ -1524,27 +1524,27 @@ it("margin_auto_left_right_child_bigger_than_parent", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-20 === root_child0.getComputedLeft(), "-20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-20); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1553,43 +1553,43 @@ it("margin_auto_left_right_child_bigger_than_parent", function () { config.free(); } }); -it("margin_auto_left_child_bigger_than_parent", function () { - var config = Yoga.Config.create(); +test("margin_auto_left_child_bigger_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(52); root.setHeight(52); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setWidth(72); root_child0.setHeight(72); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-20 === root_child0.getComputedLeft(), "-20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-20); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1598,16 +1598,16 @@ it("margin_auto_left_child_bigger_than_parent", function () { config.free(); } }); -it("margin_fix_left_auto_right_child_bigger_than_parent", function () { - var config = Yoga.Config.create(); +test("margin_fix_left_auto_right_child_bigger_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(52); root.setHeight(52); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, 10); root_child0.setMargin(Yoga.EDGE_RIGHT, "auto"); root_child0.setWidth(72); @@ -1615,27 +1615,27 @@ it("margin_fix_left_auto_right_child_bigger_than_parent", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-20 === root_child0.getComputedLeft(), "-20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-20); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1644,16 +1644,16 @@ it("margin_fix_left_auto_right_child_bigger_than_parent", function () { config.free(); } }); -it("margin_auto_left_fix_right_child_bigger_than_parent", function () { - var config = Yoga.Config.create(); +test("margin_auto_left_fix_right_child_bigger_than_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(52); root.setHeight(52); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root_child0.setMargin(Yoga.EDGE_RIGHT, 10); root_child0.setWidth(72); @@ -1661,27 +1661,27 @@ it("margin_auto_left_fix_right_child_bigger_than_parent", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(52 === root.getComputedWidth(), "52 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(52 === root.getComputedHeight(), "52 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(52); + expect(root.getComputedHeight()).toBe(52); - console.assert(-30 === root_child0.getComputedLeft(), "-30 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-10 === root_child0.getComputedTop(), "-10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(72 === root_child0.getComputedWidth(), "72 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(72 === root_child0.getComputedHeight(), "72 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-30); + expect(root_child0.getComputedTop()).toBe(-10); + expect(root_child0.getComputedWidth()).toBe(72); + expect(root_child0.getComputedHeight()).toBe(72); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1690,59 +1690,59 @@ it("margin_auto_left_fix_right_child_bigger_than_parent", function () { config.free(); } }); -it("margin_auto_top_stretching_child", function () { - var config = Yoga.Config.create(); +test("margin_auto_top_stretching_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setMargin(Yoga.EDGE_TOP, "auto"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(150 === root_child0.getComputedHeight(), "150 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(150); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(150 === root_child0.getComputedHeight(), "150 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(150); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1751,59 +1751,59 @@ it("margin_auto_top_stretching_child", function () { config.free(); } }); -it("margin_auto_left_stretching_child", function () { - var config = Yoga.Config.create(); +test("margin_auto_left_stretching_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root_child0.setFlexBasis("0%"); root_child0.setMargin(Yoga.EDGE_LEFT, "auto"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(200 === root_child0.getComputedLeft(), "200 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(150 === root_child0.getComputedHeight(), "150 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(200); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(150); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(200 === root_child0.getComputedLeft(), "200 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(150 === root_child0.getComputedHeight(), "150 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(200); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(150); - console.assert(75 === root_child1.getComputedLeft(), "75 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(150 === root_child1.getComputedTop(), "150 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(75); + expect(root_child1.getComputedTop()).toBe(150); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGMinMaxDimensionTest.test.js b/javascript/tests/generated/YGMinMaxDimensionTest.test.js index 5dc664f7..da80ff59 100644 --- a/javascript/tests/generated/YGMinMaxDimensionTest.test.js +++ b/javascript/tests/generated/YGMinMaxDimensionTest.test.js @@ -7,41 +7,41 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGMinMaxDimensionTest.html -it("max_width", function () { - var config = Yoga.Config.create(); +test("max_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMaxWidth(50); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -50,42 +50,42 @@ it("max_width", function () { config.free(); } }); -it("max_height", function () { - var config = Yoga.Config.create(); +test("max_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setMaxHeight(50); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -94,43 +94,43 @@ it("max_height", function () { config.free(); } }); -it("justify_content_min_max", function () { - var config = Yoga.Config.create(); +test("justify_content_min_max", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setWidth(100); root.setMinHeight(100); root.setMaxHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(60); root_child0.setHeight(60); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(60); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(40); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(60); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -139,43 +139,43 @@ it("justify_content_min_max", function () { config.free(); } }); -it("align_items_min_max", function () { - var config = Yoga.Config.create(); +test("align_items_min_max", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_CENTER); root.setMinWidth(100); root.setMaxWidth(200); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(60); root_child0.setHeight(60); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(60); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(60); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -184,72 +184,72 @@ it("align_items_min_max", function () { config.free(); } }); -it("justify_content_overflow_min_max", function () { - var config = Yoga.Config.create(); +test("justify_content_overflow_min_max", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setMinHeight(100); root.setMaxHeight(110); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(50); root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root_child1.setHeight(50); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(50); root_child2.setHeight(50); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(110 === root.getComputedHeight(), "110 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); + expect(root.getComputedHeight()).toBe(110); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-20 === root_child0.getComputedTop(), "-20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(-20); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(30); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(80); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(50 === root.getComputedWidth(), "50 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(110 === root.getComputedHeight(), "110 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(50); + expect(root.getComputedHeight()).toBe(110); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-20 === root_child0.getComputedTop(), "-20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(-20); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(30 === root_child1.getComputedTop(), "30 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(30); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(50); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(80 === root_child2.getComputedTop(), "80 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(50 === root_child2.getComputedWidth(), "50 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(50 === root_child2.getComputedHeight(), "50 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(80); + expect(root_child2.getComputedWidth()).toBe(50); + expect(root_child2.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -258,56 +258,56 @@ it("justify_content_overflow_min_max", function () { config.free(); } }); -it("flex_grow_to_min", function () { - var config = Yoga.Config.create(); +test("flex_grow_to_min", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setMinHeight(100); root.setMaxHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexShrink(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -316,57 +316,57 @@ it("flex_grow_to_min", function () { config.free(); } }); -it("flex_grow_in_at_most_container", function () { - var config = Yoga.Config.create(); +test("flex_grow_in_at_most_container", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexBasis(0); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(0 === root_child0_child0.getComputedWidth(), "0 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0_child0.getComputedHeight(), "0 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(0); + expect(root_child0_child0.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -375,41 +375,41 @@ it("flex_grow_in_at_most_container", function () { config.free(); } }); -it("flex_grow_child", function () { - var config = Yoga.Config.create(); +test("flex_grow_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(0); root_child0.setHeight(100); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -418,54 +418,54 @@ it("flex_grow_child", function () { config.free(); } }); -it("flex_grow_within_constrained_min_max_column", function () { - var config = Yoga.Config.create(); +test("flex_grow_within_constrained_min_max_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setMinHeight(100); root.setMaxHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -474,56 +474,56 @@ it("flex_grow_within_constrained_min_max_column", function () { config.free(); } }); -it("flex_grow_within_max_width", function () { - var config = Yoga.Config.create(); +test("flex_grow_within_max_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setMaxWidth(100); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -532,56 +532,56 @@ it("flex_grow_within_max_width", function () { config.free(); } }); -it("flex_grow_within_constrained_max_width", function () { - var config = Yoga.Config.create(); +test("flex_grow_within_constrained_max_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setMaxWidth(300); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setHeight(20); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(20); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -590,57 +590,57 @@ it("flex_grow_within_constrained_max_width", function () { config.free(); } }); -it("flex_root_ignored", function () { - var config = Yoga.Config.create(); +test("flex_root_ignored", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexGrow(1); root.setWidth(100); root.setMinHeight(100); root.setMaxHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(200); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(100); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(300 === root.getComputedHeight(), "300 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(300); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(200 === root_child1.getComputedTop(), "200 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(200); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(300 === root.getComputedHeight(), "300 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(300); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(200 === root_child1.getComputedTop(), "200 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(200); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -649,72 +649,72 @@ it("flex_root_ignored", function () { config.free(); } }); -it("flex_grow_root_minimized", function () { - var config = Yoga.Config.create(); +test("flex_grow_root_minimized", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setMinHeight(100); root.setMaxHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMinHeight(100); root_child0.setMaxHeight(500); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexBasis(200); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(300 === root.getComputedHeight(), "300 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(300); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(300 === root_child0.getComputedHeight(), "300 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(300); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(200 === root_child0_child1.getComputedTop(), "200 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(100 === root_child0_child1.getComputedWidth(), "100 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(100 === root_child0_child1.getComputedHeight(), "100 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(200); + expect(root_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(300 === root.getComputedHeight(), "300 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(300); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(300 === root_child0.getComputedHeight(), "300 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(300); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(200 === root_child0_child1.getComputedTop(), "200 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(100 === root_child0_child1.getComputedWidth(), "100 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(100 === root_child0_child1.getComputedHeight(), "100 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(200); + expect(root_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -723,71 +723,71 @@ it("flex_grow_root_minimized", function () { config.free(); } }); -it("flex_grow_height_maximized", function () { - var config = Yoga.Config.create(); +test("flex_grow_height_maximized", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMinHeight(100); root_child0.setMaxHeight(500); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexBasis(200); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setHeight(100); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(500 === root_child0.getComputedHeight(), "500 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(500); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(400 === root_child0_child0.getComputedHeight(), "400 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(400); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(400 === root_child0_child1.getComputedTop(), "400 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(100 === root_child0_child1.getComputedWidth(), "100 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(100 === root_child0_child1.getComputedHeight(), "100 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(400); + expect(root_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(500); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(500 === root_child0.getComputedHeight(), "500 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(500); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(400 === root_child0_child0.getComputedHeight(), "400 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(400); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(400 === root_child0_child1.getComputedTop(), "400 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(100 === root_child0_child1.getComputedWidth(), "100 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(100 === root_child0_child1.getComputedHeight(), "100 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(400); + expect(root_child0_child1.getComputedWidth()).toBe(100); + expect(root_child0_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -796,55 +796,55 @@ it("flex_grow_height_maximized", function () { config.free(); } }); -it("flex_grow_within_constrained_min_row", function () { - var config = Yoga.Config.create(); +test("flex_grow_within_constrained_min_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setMinWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setWidth(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child1.getComputedLeft(), "50 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(50); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(50 === root_child0.getComputedWidth(), "50 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(50); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(50 === root_child1.getComputedWidth(), "50 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(50); + expect(root_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -853,53 +853,53 @@ it("flex_grow_within_constrained_min_row", function () { config.free(); } }); -it("flex_grow_within_constrained_min_column", function () { - var config = Yoga.Config.create(); +test("flex_grow_within_constrained_min_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setMinHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(0 === root_child1.getComputedWidth(), "0 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(0); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -908,70 +908,70 @@ it("flex_grow_within_constrained_min_column", function () { config.free(); } }); -it("flex_grow_within_constrained_max_row", function () { - var config = Yoga.Config.create(); +test("flex_grow_within_constrained_max_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setMaxWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexShrink(1); root_child0_child0.setFlexBasis(100); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth(50); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0.getComputedWidth(), "50 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child0_child1.getComputedLeft(), "50 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child1.getComputedTop(), "0 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(50 === root_child0_child1.getComputedWidth(), "50 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(100 === root_child0_child1.getComputedHeight(), "100 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(50); + expect(root_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child1.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(50 === root_child0_child0.getComputedLeft(), "50 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0.getComputedWidth(), "50 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0_child0.getComputedHeight(), "100 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child1.getComputedTop(), "0 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(50 === root_child0_child1.getComputedWidth(), "50 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(100 === root_child0_child1.getComputedHeight(), "100 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child1.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -980,55 +980,55 @@ it("flex_grow_within_constrained_max_row", function () { config.free(); } }); -it("flex_grow_within_constrained_max_column", function () { - var config = Yoga.Config.create(); +test("flex_grow_within_constrained_max_column", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setMaxHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setFlexBasis(100); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setHeight(50); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1037,59 +1037,59 @@ it("flex_grow_within_constrained_max_column", function () { config.free(); } }); -it("child_min_max_width_flexing", function () { - var config = Yoga.Config.create(); +test("child_min_max_width_flexing", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(120); root.setHeight(50); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(0); root_child0.setMinWidth(60); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexBasis("50%"); root_child1.setMaxWidth(20); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(120 === root.getComputedWidth(), "120 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(120); + expect(root.getComputedHeight()).toBe(50); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(100 === root_child1.getComputedLeft(), "100 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(100); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(120 === root.getComputedWidth(), "120 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(120); + expect(root.getComputedHeight()).toBe(50); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(20 === root_child1.getComputedWidth(), "20 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(50 === root_child1.getComputedHeight(), "50 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(20); + expect(root_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1098,26 +1098,26 @@ it("child_min_max_width_flexing", function () { config.free(); } }); -it("min_width_overrides_width", function () { - var config = Yoga.Config.create(); +test("min_width_overrides_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(50); root.setMinWidth(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1126,26 +1126,26 @@ it("min_width_overrides_width", function () { config.free(); } }); -it("max_width_overrides_width", function () { - var config = Yoga.Config.create(); +test("max_width_overrides_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setMaxWidth(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1154,26 +1154,26 @@ it("max_width_overrides_width", function () { config.free(); } }); -it("min_height_overrides_height", function () { - var config = Yoga.Config.create(); +test("min_height_overrides_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setHeight(50); root.setMinHeight(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1182,26 +1182,26 @@ it("min_height_overrides_height", function () { config.free(); } }); -it("max_height_overrides_height", function () { - var config = Yoga.Config.create(); +test("max_height_overrides_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setHeight(200); root.setMaxHeight(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1210,16 +1210,16 @@ it("max_height_overrides_height", function () { config.free(); } }); -it("min_max_percent_no_width_height", function () { - var config = Yoga.Config.create(); +test("min_max_percent_no_width_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setAlignItems(Yoga.ALIGN_FLEX_START); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setMinWidth("10%"); root_child0.setMaxWidth("10%"); root_child0.setMinHeight("10%"); @@ -1227,27 +1227,27 @@ it("min_max_percent_no_width_height", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGPaddingTest.test.js b/javascript/tests/generated/YGPaddingTest.test.js index 7c66af06..b6257fc8 100644 --- a/javascript/tests/generated/YGPaddingTest.test.js +++ b/javascript/tests/generated/YGPaddingTest.test.js @@ -7,28 +7,28 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGPaddingTest.html -it("padding_no_size", function () { - var config = Yoga.Config.create(); +test("padding_no_size", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setPadding(Yoga.EDGE_LEFT, 10); root.setPadding(Yoga.EDGE_TOP, 10); root.setPadding(Yoga.EDGE_RIGHT, 10); root.setPadding(Yoga.EDGE_BOTTOM, 10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(20); + expect(root.getComputedHeight()).toBe(20); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(20 === root.getComputedWidth(), "20 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(20 === root.getComputedHeight(), "20 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(20); + expect(root.getComputedHeight()).toBe(20); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -37,43 +37,43 @@ it("padding_no_size", function () { config.free(); } }); -it("padding_container_match_child", function () { - var config = Yoga.Config.create(); +test("padding_container_match_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setPadding(Yoga.EDGE_LEFT, 10); root.setPadding(Yoga.EDGE_TOP, 10); root.setPadding(Yoga.EDGE_RIGHT, 10); root.setPadding(Yoga.EDGE_BOTTOM, 10); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(30 === root.getComputedWidth(), "30 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(30 === root.getComputedHeight(), "30 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(30); + expect(root.getComputedHeight()).toBe(30); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(30 === root.getComputedWidth(), "30 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(30 === root.getComputedHeight(), "30 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(30); + expect(root.getComputedHeight()).toBe(30); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -82,11 +82,11 @@ it("padding_container_match_child", function () { config.free(); } }); -it("padding_flex_child", function () { - var config = Yoga.Config.create(); +test("padding_flex_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setPadding(Yoga.EDGE_LEFT, 10); root.setPadding(Yoga.EDGE_TOP, 10); root.setPadding(Yoga.EDGE_RIGHT, 10); @@ -94,33 +94,33 @@ it("padding_flex_child", function () { root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setWidth(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(80); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(80 === root_child0.getComputedHeight(), "80 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(80); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -129,11 +129,11 @@ it("padding_flex_child", function () { config.free(); } }); -it("padding_stretch_child", function () { - var config = Yoga.Config.create(); +test("padding_stretch_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setPadding(Yoga.EDGE_LEFT, 10); root.setPadding(Yoga.EDGE_TOP, 10); root.setPadding(Yoga.EDGE_RIGHT, 10); @@ -141,32 +141,32 @@ it("padding_stretch_child", function () { root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(10 === root_child0.getComputedLeft(), "10 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(80 === root_child0.getComputedWidth(), "80 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(10); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(80); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -175,11 +175,11 @@ it("padding_stretch_child", function () { config.free(); } }); -it("padding_center_child", function () { - var config = Yoga.Config.create(); +test("padding_center_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setPadding(Yoga.EDGE_START, 10); @@ -188,33 +188,33 @@ it("padding_center_child", function () { root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(10); root_child0.setHeight(10); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(35 === root_child0.getComputedTop(), "35 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(40); + expect(root_child0.getComputedTop()).toBe(35); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(35 === root_child0.getComputedTop(), "35 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(35); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -223,17 +223,17 @@ it("padding_center_child", function () { config.free(); } }); -it("child_with_padding_align_end", function () { - var config = Yoga.Config.create(); +test("child_with_padding_align_end", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_FLEX_END); root.setAlignItems(Yoga.ALIGN_FLEX_END); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPadding(Yoga.EDGE_LEFT, 20); root_child0.setPadding(Yoga.EDGE_TOP, 20); root_child0.setPadding(Yoga.EDGE_RIGHT, 20); @@ -243,27 +243,27 @@ it("child_with_padding_align_end", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(100 === root_child0.getComputedLeft(), "100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(100 === root_child0.getComputedTop(), "100 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(100); + expect(root_child0.getComputedTop()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(100 === root_child0.getComputedTop(), "100 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(100); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGPercentageTest.test.js b/javascript/tests/generated/YGPercentageTest.test.js index d9193507..3f39ee6c 100644 --- a/javascript/tests/generated/YGPercentageTest.test.js +++ b/javascript/tests/generated/YGPercentageTest.test.js @@ -7,42 +7,42 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html -it("percentage_width_height", function () { - var config = Yoga.Config.create(); +test("percentage_width_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth("30%"); root_child0.setHeight("30%"); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(60); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(140 === root_child0.getComputedLeft(), "140 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(140); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(60); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -51,16 +51,16 @@ it("percentage_width_height", function () { config.free(); } }); -it("percentage_position_left_top", function () { - var config = Yoga.Config.create(); +test("percentage_position_left_top", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(400); root.setHeight(400); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPosition(Yoga.EDGE_LEFT, "10%"); root_child0.setPosition(Yoga.EDGE_TOP, "20%"); root_child0.setWidth("45%"); @@ -68,27 +68,27 @@ it("percentage_position_left_top", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(400 === root.getComputedWidth(), "400 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(400 === root.getComputedHeight(), "400 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(400); + expect(root.getComputedHeight()).toBe(400); - console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(180 === root_child0.getComputedWidth(), "180 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(220 === root_child0.getComputedHeight(), "220 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(40); + expect(root_child0.getComputedTop()).toBe(80); + expect(root_child0.getComputedWidth()).toBe(180); + expect(root_child0.getComputedHeight()).toBe(220); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(400 === root.getComputedWidth(), "400 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(400 === root.getComputedHeight(), "400 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(400); + expect(root.getComputedHeight()).toBe(400); - console.assert(260 === root_child0.getComputedLeft(), "260 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(80 === root_child0.getComputedTop(), "80 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(180 === root_child0.getComputedWidth(), "180 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(220 === root_child0.getComputedHeight(), "220 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(260); + expect(root_child0.getComputedTop()).toBe(80); + expect(root_child0.getComputedWidth()).toBe(180); + expect(root_child0.getComputedHeight()).toBe(220); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -97,16 +97,16 @@ it("percentage_position_left_top", function () { config.free(); } }); -it("percentage_position_bottom_right", function () { - var config = Yoga.Config.create(); +test("percentage_position_bottom_right", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(500); root.setHeight(500); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPosition(Yoga.EDGE_RIGHT, "20%"); root_child0.setPosition(Yoga.EDGE_BOTTOM, "10%"); root_child0.setWidth("55%"); @@ -114,27 +114,27 @@ it("percentage_position_bottom_right", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(-100 === root_child0.getComputedLeft(), "-100 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-50 === root_child0.getComputedTop(), "-50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(275 === root_child0.getComputedWidth(), "275 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(75 === root_child0.getComputedHeight(), "75 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(-100); + expect(root_child0.getComputedTop()).toBe(-50); + expect(root_child0.getComputedWidth()).toBe(275); + expect(root_child0.getComputedHeight()).toBe(75); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(500 === root.getComputedWidth(), "500 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(500 === root.getComputedHeight(), "500 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(500); + expect(root.getComputedHeight()).toBe(500); - console.assert(125 === root_child0.getComputedLeft(), "125 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(-50 === root_child0.getComputedTop(), "-50 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(275 === root_child0.getComputedWidth(), "275 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(75 === root_child0.getComputedHeight(), "75 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(125); + expect(root_child0.getComputedTop()).toBe(-50); + expect(root_child0.getComputedWidth()).toBe(275); + expect(root_child0.getComputedHeight()).toBe(75); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -143,57 +143,57 @@ it("percentage_position_bottom_right", function () { config.free(); } }); -it("percentage_flex_basis", function () { - var config = Yoga.Config.create(); +test("percentage_flex_basis", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("50%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexBasis("25%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(125 === root_child0.getComputedWidth(), "125 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(125); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(125 === root_child1.getComputedLeft(), "125 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(75 === root_child1.getComputedWidth(), "75 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(125); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(75); + expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(75 === root_child0.getComputedLeft(), "75 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(125 === root_child0.getComputedWidth(), "125 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(75); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(125); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(75 === root_child1.getComputedWidth(), "75 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(75); + expect(root_child1.getComputedHeight()).toBe(200); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -202,56 +202,56 @@ it("percentage_flex_basis", function () { config.free(); } }); -it("percentage_flex_basis_cross", function () { - var config = Yoga.Config.create(); +test("percentage_flex_basis_cross", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("50%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setFlexBasis("25%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(125 === root_child0.getComputedHeight(), "125 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(125); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(125 === root_child1.getComputedTop(), "125 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(75 === root_child1.getComputedHeight(), "75 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(125); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(75); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(125 === root_child0.getComputedHeight(), "125 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(125); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(125 === root_child1.getComputedTop(), "125 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(75 === root_child1.getComputedHeight(), "75 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(125); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(75); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -260,59 +260,59 @@ it("percentage_flex_basis_cross", function () { config.free(); } }); -it("percentage_flex_basis_main_max_height", function () { - var config = Yoga.Config.create(); +test("percentage_flex_basis_main_max_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMaxHeight("60%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("10%"); root_child1.setMaxHeight("20%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(52 === root_child0.getComputedWidth(), "52 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0.getComputedHeight(), "120 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(52); + expect(root_child0.getComputedHeight()).toBe(120); - console.assert(52 === root_child1.getComputedLeft(), "52 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(148 === root_child1.getComputedWidth(), "148 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(52); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(148); + expect(root_child1.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(148 === root_child0.getComputedLeft(), "148 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(52 === root_child0.getComputedWidth(), "52 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0.getComputedHeight(), "120 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(148); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(52); + expect(root_child0.getComputedHeight()).toBe(120); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(148 === root_child1.getComputedWidth(), "148 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(148); + expect(root_child1.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -321,58 +321,58 @@ it("percentage_flex_basis_main_max_height", function () { config.free(); } }); -it("percentage_flex_basis_cross_max_height", function () { - var config = Yoga.Config.create(); +test("percentage_flex_basis_cross_max_height", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMaxHeight("60%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("10%"); root_child1.setMaxHeight("20%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0.getComputedHeight(), "120 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(120); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(120 === root_child1.getComputedTop(), "120 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(120); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(40); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(120 === root_child0.getComputedHeight(), "120 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(120); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(120 === root_child1.getComputedTop(), "120 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(40 === root_child1.getComputedHeight(), "40 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(120); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(40); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -381,59 +381,59 @@ it("percentage_flex_basis_cross_max_height", function () { config.free(); } }); -it("percentage_flex_basis_main_max_width", function () { - var config = Yoga.Config.create(); +test("percentage_flex_basis_main_max_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("15%"); root_child0.setMaxWidth("60%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("10%"); root_child1.setMaxWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(120 === root_child0.getComputedWidth(), "120 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(120); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(120 === root_child1.getComputedLeft(), "120 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(40 === root_child1.getComputedWidth(), "40 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(120); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(40); + expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(120 === root_child0.getComputedWidth(), "120 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(120); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(40 === root_child1.getComputedLeft(), "40 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(40 === root_child1.getComputedWidth(), "40 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(40); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(40); + expect(root_child1.getComputedHeight()).toBe(200); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -442,58 +442,58 @@ it("percentage_flex_basis_main_max_width", function () { config.free(); } }); -it("percentage_flex_basis_cross_max_width", function () { - var config = Yoga.Config.create(); +test("percentage_flex_basis_cross_max_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMaxWidth("60%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("15%"); root_child1.setMaxWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(120 === root_child0.getComputedWidth(), "120 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(120); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(40 === root_child1.getComputedWidth(), "40 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(40); + expect(root_child1.getComputedHeight()).toBe(150); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(120 === root_child0.getComputedWidth(), "120 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(120); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(160 === root_child1.getComputedLeft(), "160 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(40 === root_child1.getComputedWidth(), "40 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(160); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(40); + expect(root_child1.getComputedHeight()).toBe(150); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -502,59 +502,59 @@ it("percentage_flex_basis_cross_max_width", function () { config.free(); } }); -it("percentage_flex_basis_main_min_width", function () { - var config = Yoga.Config.create(); +test("percentage_flex_basis_main_min_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("15%"); root_child0.setMinWidth("60%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("10%"); root_child1.setMinWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(120 === root_child0.getComputedWidth(), "120 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(120); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(120 === root_child1.getComputedLeft(), "120 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(80 === root_child1.getComputedWidth(), "80 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(120); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(80); + expect(root_child1.getComputedHeight()).toBe(200); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(80 === root_child0.getComputedLeft(), "80 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(120 === root_child0.getComputedWidth(), "120 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(80); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(120); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(80 === root_child1.getComputedWidth(), "80 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(200 === root_child1.getComputedHeight(), "200 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(80); + expect(root_child1.getComputedHeight()).toBe(200); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -563,58 +563,58 @@ it("percentage_flex_basis_main_min_width", function () { config.free(); } }); -it("percentage_flex_basis_cross_min_width", function () { - var config = Yoga.Config.create(); +test("percentage_flex_basis_cross_min_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMinWidth("60%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("15%"); root_child1.setMinWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(150); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(50 === root_child1.getComputedTop(), "50 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(150 === root_child1.getComputedHeight(), "150 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(50); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(150); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -623,15 +623,15 @@ it("percentage_flex_basis_cross_min_width", function () { config.free(); } }); -it("percentage_multiple_nested_with_padding_margin_and_percentage_values", function () { - var config = Yoga.Config.create(); +test("percentage_multiple_nested_with_padding_margin_and_percentage_values", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis("10%"); root_child0.setMargin(Yoga.EDGE_LEFT, 5); @@ -645,7 +645,7 @@ it("percentage_multiple_nested_with_padding_margin_and_percentage_values", funct root_child0.setMinWidth("60%"); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setMargin(Yoga.EDGE_LEFT, 5); root_child0_child0.setMargin(Yoga.EDGE_TOP, 5); root_child0_child0.setMargin(Yoga.EDGE_RIGHT, 5); @@ -657,7 +657,7 @@ it("percentage_multiple_nested_with_padding_margin_and_percentage_values", funct root_child0_child0.setWidth("50%"); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setMargin(Yoga.EDGE_LEFT, "5%"); root_child0_child0_child0.setMargin(Yoga.EDGE_TOP, "5%"); root_child0_child0_child0.setMargin(Yoga.EDGE_RIGHT, "5%"); @@ -669,64 +669,64 @@ it("percentage_multiple_nested_with_padding_margin_and_percentage_values", funct root_child0_child0_child0.setWidth("45%"); root_child0_child0.insertChild(root_child0_child0_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(4); root_child1.setFlexBasis("15%"); root_child1.setMinWidth("20%"); root.insertChild(root_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(5 === root_child0.getComputedTop(), "5 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(190 === root_child0.getComputedWidth(), "190 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(48 === root_child0.getComputedHeight(), "48 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(5); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(190); + expect(root_child0.getComputedHeight()).toBe(48); - console.assert(8 === root_child0_child0.getComputedLeft(), "8 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(8 === root_child0_child0.getComputedTop(), "8 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(92 === root_child0_child0.getComputedWidth(), "92 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(25 === root_child0_child0.getComputedHeight(), "25 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(8); + expect(root_child0_child0.getComputedTop()).toBe(8); + expect(root_child0_child0.getComputedWidth()).toBe(92); + expect(root_child0_child0.getComputedHeight()).toBe(25); - console.assert(10 === root_child0_child0_child0.getComputedLeft(), "10 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0_child0_child0.getComputedTop(), "10 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(36 === root_child0_child0_child0.getComputedWidth(), "36 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(6 === root_child0_child0_child0.getComputedHeight(), "6 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(10); + expect(root_child0_child0_child0.getComputedTop()).toBe(10); + expect(root_child0_child0_child0.getComputedWidth()).toBe(36); + expect(root_child0_child0_child0.getComputedHeight()).toBe(6); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(58 === root_child1.getComputedTop(), "58 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(142 === root_child1.getComputedHeight(), "142 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(58); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(142); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(5 === root_child0.getComputedLeft(), "5 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(5 === root_child0.getComputedTop(), "5 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(190 === root_child0.getComputedWidth(), "190 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(48 === root_child0.getComputedHeight(), "48 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(5); + expect(root_child0.getComputedTop()).toBe(5); + expect(root_child0.getComputedWidth()).toBe(190); + expect(root_child0.getComputedHeight()).toBe(48); - console.assert(90 === root_child0_child0.getComputedLeft(), "90 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(8 === root_child0_child0.getComputedTop(), "8 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(92 === root_child0_child0.getComputedWidth(), "92 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(25 === root_child0_child0.getComputedHeight(), "25 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(90); + expect(root_child0_child0.getComputedTop()).toBe(8); + expect(root_child0_child0.getComputedWidth()).toBe(92); + expect(root_child0_child0.getComputedHeight()).toBe(25); - console.assert(46 === root_child0_child0_child0.getComputedLeft(), "46 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0_child0_child0.getComputedTop(), "10 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(36 === root_child0_child0_child0.getComputedWidth(), "36 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(6 === root_child0_child0_child0.getComputedHeight(), "6 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(46); + expect(root_child0_child0_child0.getComputedTop()).toBe(10); + expect(root_child0_child0_child0.getComputedWidth()).toBe(36); + expect(root_child0_child0_child0.getComputedHeight()).toBe(6); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(58 === root_child1.getComputedTop(), "58 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(200 === root_child1.getComputedWidth(), "200 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(142 === root_child1.getComputedHeight(), "142 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(58); + expect(root_child1.getComputedWidth()).toBe(200); + expect(root_child1.getComputedHeight()).toBe(142); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -735,15 +735,15 @@ it("percentage_multiple_nested_with_padding_margin_and_percentage_values", funct config.free(); } }); -it("percentage_margin_should_calculate_based_only_on_width", function () { - var config = Yoga.Config.create(); +test("percentage_margin_should_calculate_based_only_on_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setMargin(Yoga.EDGE_LEFT, "10%"); root_child0.setMargin(Yoga.EDGE_TOP, "10%"); @@ -751,43 +751,43 @@ it("percentage_margin_should_calculate_based_only_on_width", function () { root_child0.setMargin(Yoga.EDGE_BOTTOM, "10%"); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(160 === root_child0.getComputedWidth(), "160 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(160); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(10); + expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0.getComputedTop(), "20 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(160 === root_child0.getComputedWidth(), "160 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(60 === root_child0.getComputedHeight(), "60 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(20); + expect(root_child0.getComputedTop()).toBe(20); + expect(root_child0.getComputedWidth()).toBe(160); + expect(root_child0.getComputedHeight()).toBe(60); - console.assert(150 === root_child0_child0.getComputedLeft(), "150 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(150); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(10); + expect(root_child0_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -796,15 +796,15 @@ it("percentage_margin_should_calculate_based_only_on_width", function () { config.free(); } }); -it("percentage_padding_should_calculate_based_only_on_width", function () { - var config = Yoga.Config.create(); +test("percentage_padding_should_calculate_based_only_on_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setPadding(Yoga.EDGE_LEFT, "10%"); root_child0.setPadding(Yoga.EDGE_TOP, "10%"); @@ -812,43 +812,43 @@ it("percentage_padding_should_calculate_based_only_on_width", function () { root_child0.setPadding(Yoga.EDGE_BOTTOM, "10%"); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(10); root_child0_child0.setHeight(10); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(20 === root_child0_child0.getComputedLeft(), "20 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0_child0.getComputedTop(), "20 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(20); + expect(root_child0_child0.getComputedTop()).toBe(20); + expect(root_child0_child0.getComputedWidth()).toBe(10); + expect(root_child0_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(200 === root_child0.getComputedWidth(), "200 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(200); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(170 === root_child0_child0.getComputedLeft(), "170 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(20 === root_child0_child0.getComputedTop(), "20 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(10 === root_child0_child0.getComputedWidth(), "10 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0_child0.getComputedHeight(), "10 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(170); + expect(root_child0_child0.getComputedTop()).toBe(20); + expect(root_child0_child0.getComputedWidth()).toBe(10); + expect(root_child0_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -857,15 +857,15 @@ it("percentage_padding_should_calculate_based_only_on_width", function () { config.free(); } }); -it("percentage_absolute_position", function () { - var config = Yoga.Config.create(); +test("percentage_absolute_position", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(200); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_LEFT, "30%"); root_child0.setPosition(Yoga.EDGE_TOP, "10%"); @@ -874,27 +874,27 @@ it("percentage_absolute_position", function () { root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(60 === root_child0.getComputedLeft(), "60 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(60); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(100); - console.assert(60 === root_child0.getComputedLeft(), "60 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(10 === root_child0.getComputedTop(), "10 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(60); + expect(root_child0.getComputedTop()).toBe(10); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -903,39 +903,39 @@ it("percentage_absolute_position", function () { config.free(); } }); -it("percentage_width_height_undefined_parent_size", function () { - var config = Yoga.Config.create(); +test("percentage_width_height_undefined_parent_size", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth("50%"); root_child0.setHeight("50%"); root.insertChild(root_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(0); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(0 === root.getComputedWidth(), "0 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(0 === root.getComputedHeight(), "0 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(0); + expect(root.getComputedHeight()).toBe(0); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(0 === root_child0.getComputedWidth(), "0 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(0 === root_child0.getComputedHeight(), "0 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(0); + expect(root_child0.getComputedHeight()).toBe(0); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -944,83 +944,83 @@ it("percentage_width_height_undefined_parent_size", function () { config.free(); } }); -it("percent_within_flex_grow", function () { - var config = Yoga.Config.create(); +test("percent_within_flex_grow", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(350); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setWidth("100%"); root_child1.insertChild(root_child1_child0, 0); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setWidth(100); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(350 === root.getComputedWidth(), "350 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(350); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(100 === root_child1.getComputedLeft(), "100 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(150 === root_child1.getComputedWidth(), "150 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(100); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(150); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(150 === root_child1_child0.getComputedWidth(), "150 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(0 === root_child1_child0.getComputedHeight(), "0 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(150); + expect(root_child1_child0.getComputedHeight()).toBe(0); - console.assert(250 === root_child2.getComputedLeft(), "250 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(250); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(350 === root.getComputedWidth(), "350 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(350); + expect(root.getComputedHeight()).toBe(100); - console.assert(250 === root_child0.getComputedLeft(), "250 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(250); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(100 === root_child1.getComputedLeft(), "100 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(150 === root_child1.getComputedWidth(), "150 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(100); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(150); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(150 === root_child1_child0.getComputedWidth(), "150 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(0 === root_child1_child0.getComputedHeight(), "0 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(150); + expect(root_child1_child0.getComputedHeight()).toBe(0); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1029,87 +1029,87 @@ it("percent_within_flex_grow", function () { config.free(); } }); -it("percentage_container_in_wrapping_container", function () { - var config = Yoga.Config.create(); +test("percentage_container_in_wrapping_container", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setJustifyContent(Yoga.JUSTIFY_CENTER); root.setAlignItems(Yoga.ALIGN_CENTER); root.setWidth(200); root.setHeight(200); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0_child0.setJustifyContent(Yoga.JUSTIFY_CENTER); root_child0_child0.setWidth("100%"); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child0_child0 = Yoga.Node.create(config); + const root_child0_child0_child0 = Yoga.Node.create(config); root_child0_child0_child0.setWidth(50); root_child0_child0_child0.setHeight(50); root_child0_child0.insertChild(root_child0_child0_child0, 0); - var root_child0_child0_child1 = Yoga.Node.create(config); + const root_child0_child0_child1 = Yoga.Node.create(config); root_child0_child0_child1.setWidth(50); root_child0_child0_child1.setHeight(50); root_child0_child0.insertChild(root_child0_child0_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(75); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0_child0.getComputedWidth(), "50 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0_child0.getComputedHeight(), "50 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child0_child0_child1.getComputedLeft(), "50 === root_child0_child0_child1.getComputedLeft() (" + root_child0_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child1.getComputedTop(), "0 === root_child0_child0_child1.getComputedTop() (" + root_child0_child0_child1.getComputedTop() + ")"); - console.assert(50 === root_child0_child0_child1.getComputedWidth(), "50 === root_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child1.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0_child1.getComputedHeight(), "50 === root_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child1.getComputedLeft()).toBe(50); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(200); + expect(root.getComputedHeight()).toBe(200); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(75); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(50); - console.assert(50 === root_child0_child0_child0.getComputedLeft(), "50 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")"); - console.assert(50 === root_child0_child0_child0.getComputedWidth(), "50 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0_child0.getComputedHeight(), "50 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0_child0.getComputedLeft()).toBe(50); + expect(root_child0_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0_child0.getComputedWidth()).toBe(50); + expect(root_child0_child0_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0_child1.getComputedLeft(), "0 === root_child0_child0_child1.getComputedLeft() (" + root_child0_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0_child1.getComputedTop(), "0 === root_child0_child0_child1.getComputedTop() (" + root_child0_child0_child1.getComputedTop() + ")"); - console.assert(50 === root_child0_child0_child1.getComputedWidth(), "50 === root_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child1.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0_child1.getComputedHeight(), "50 === root_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child0_child1.getComputedWidth()).toBe(50); + expect(root_child0_child0_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -1118,15 +1118,15 @@ it("percentage_container_in_wrapping_container", function () { config.free(); } }); -it("percent_absolute_position", function () { - var config = Yoga.Config.create(); +test("percent_absolute_position", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(60); root.setHeight(50); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE); root_child0.setPosition(Yoga.EDGE_LEFT, "50%"); @@ -1134,56 +1134,56 @@ it("percent_absolute_position", function () { root_child0.setHeight(50); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth("100%"); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setWidth("100%"); root_child0.insertChild(root_child0_child1, 1); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(60 === root.getComputedWidth(), "60 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(60); + expect(root.getComputedHeight()).toBe(50); - console.assert(30 === root_child0.getComputedLeft(), "30 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(30); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(60 === root_child0_child0.getComputedWidth(), "60 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(60); + expect(root_child0_child0.getComputedHeight()).toBe(50); - console.assert(60 === root_child0_child1.getComputedLeft(), "60 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child1.getComputedTop(), "0 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(60 === root_child0_child1.getComputedWidth(), "60 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(50 === root_child0_child1.getComputedHeight(), "50 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(60); + expect(root_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child1.getComputedWidth()).toBe(60); + expect(root_child0_child1.getComputedHeight()).toBe(50); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(60 === root.getComputedWidth(), "60 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(50 === root.getComputedHeight(), "50 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(60); + expect(root.getComputedHeight()).toBe(50); - console.assert(30 === root_child0.getComputedLeft(), "30 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(60 === root_child0.getComputedWidth(), "60 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(30); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(60); + expect(root_child0.getComputedHeight()).toBe(50); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(60 === root_child0_child0.getComputedWidth(), "60 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(60); + expect(root_child0_child0.getComputedHeight()).toBe(50); - console.assert(-60 === root_child0_child1.getComputedLeft(), "-60 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(0 === root_child0_child1.getComputedTop(), "0 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(60 === root_child0_child1.getComputedWidth(), "60 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(50 === root_child0_child1.getComputedHeight(), "50 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(-60); + expect(root_child0_child1.getComputedTop()).toBe(0); + expect(root_child0_child1.getComputedWidth()).toBe(60); + expect(root_child0_child1.getComputedHeight()).toBe(50); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGRoundingTest.test.js b/javascript/tests/generated/YGRoundingTest.test.js index d599175f..8e05cf1d 100644 --- a/javascript/tests/generated/YGRoundingTest.test.js +++ b/javascript/tests/generated/YGRoundingTest.test.js @@ -7,69 +7,69 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html -it("rounding_flex_basis_flex_grow_row_width_of_100", function () { - var config = Yoga.Config.create(); +test("rounding_flex_basis_flex_grow_row_width_of_100", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(33 === root_child0.getComputedWidth(), "33 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(33); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(33 === root_child1.getComputedLeft(), "33 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(34 === root_child1.getComputedWidth(), "34 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(33); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(34); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(67 === root_child2.getComputedLeft(), "67 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(33 === root_child2.getComputedWidth(), "33 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(67); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(33); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(67 === root_child0.getComputedLeft(), "67 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(33 === root_child0.getComputedWidth(), "33 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(67); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(33); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(33 === root_child1.getComputedLeft(), "33 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(34 === root_child1.getComputedWidth(), "34 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(33); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(34); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(33 === root_child2.getComputedWidth(), "33 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(33); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -78,97 +78,97 @@ it("rounding_flex_basis_flex_grow_row_width_of_100", function () { config.free(); } }); -it("rounding_flex_basis_flex_grow_row_prime_number_width", function () { - var config = Yoga.Config.create(); +test("rounding_flex_basis_flex_grow_row_prime_number_width", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(113); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root.insertChild(root_child2, 2); - var root_child3 = Yoga.Node.create(config); + const root_child3 = Yoga.Node.create(config); root_child3.setFlexGrow(1); root.insertChild(root_child3, 3); - var root_child4 = Yoga.Node.create(config); + const root_child4 = Yoga.Node.create(config); root_child4.setFlexGrow(1); root.insertChild(root_child4, 4); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(113 === root.getComputedWidth(), "113 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(113); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(23 === root_child0.getComputedWidth(), "23 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(23); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(23 === root_child1.getComputedLeft(), "23 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(22 === root_child1.getComputedWidth(), "22 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(23); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(22); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(45 === root_child2.getComputedLeft(), "45 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(23 === root_child2.getComputedWidth(), "23 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(45); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(23); + expect(root_child2.getComputedHeight()).toBe(100); - console.assert(68 === root_child3.getComputedLeft(), "68 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(22 === root_child3.getComputedWidth(), "22 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(100 === root_child3.getComputedHeight(), "100 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(68); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(22); + expect(root_child3.getComputedHeight()).toBe(100); - console.assert(90 === root_child4.getComputedLeft(), "90 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(23 === root_child4.getComputedWidth(), "23 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(90); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(23); + expect(root_child4.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(113 === root.getComputedWidth(), "113 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(113); + expect(root.getComputedHeight()).toBe(100); - console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(23 === root_child0.getComputedWidth(), "23 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(90); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(23); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(68 === root_child1.getComputedLeft(), "68 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(22 === root_child1.getComputedWidth(), "22 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(68); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(22); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(45 === root_child2.getComputedLeft(), "45 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(23 === root_child2.getComputedWidth(), "23 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(45); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(23); + expect(root_child2.getComputedHeight()).toBe(100); - console.assert(23 === root_child3.getComputedLeft(), "23 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")"); - console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")"); - console.assert(22 === root_child3.getComputedWidth(), "22 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")"); - console.assert(100 === root_child3.getComputedHeight(), "100 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")"); + expect(root_child3.getComputedLeft()).toBe(23); + expect(root_child3.getComputedTop()).toBe(0); + expect(root_child3.getComputedWidth()).toBe(22); + expect(root_child3.getComputedHeight()).toBe(100); - console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")"); - console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")"); - console.assert(23 === root_child4.getComputedWidth(), "23 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")"); - console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")"); + expect(root_child4.getComputedLeft()).toBe(0); + expect(root_child4.getComputedTop()).toBe(0); + expect(root_child4.getComputedWidth()).toBe(23); + expect(root_child4.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -177,70 +177,70 @@ it("rounding_flex_basis_flex_grow_row_prime_number_width", function () { config.free(); } }); -it("rounding_flex_basis_flex_shrink_row", function () { - var config = Yoga.Config.create(); +test("rounding_flex_basis_flex_shrink_row", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(101); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexShrink(1); root_child0.setFlexBasis(100); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexBasis(25); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexBasis(25); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(101 === root.getComputedWidth(), "101 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(101); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(51 === root_child0.getComputedWidth(), "51 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(51); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(51 === root_child1.getComputedLeft(), "51 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(25 === root_child1.getComputedWidth(), "25 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(51); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(25); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(76 === root_child2.getComputedLeft(), "76 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(25 === root_child2.getComputedWidth(), "25 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(76); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(25); + expect(root_child2.getComputedHeight()).toBe(100); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(101 === root.getComputedWidth(), "101 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(101); + expect(root.getComputedHeight()).toBe(100); - console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(51 === root_child0.getComputedWidth(), "51 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(50); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(51); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(25 === root_child1.getComputedLeft(), "25 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(25 === root_child1.getComputedWidth(), "25 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(25); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(25); + expect(root_child1.getComputedHeight()).toBe(100); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(25 === root_child2.getComputedWidth(), "25 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(25); + expect(root_child2.getComputedHeight()).toBe(100); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -249,72 +249,72 @@ it("rounding_flex_basis_flex_shrink_row", function () { config.free(); } }); -it("rounding_flex_basis_overrides_main_size", function () { - var config = Yoga.Config.create(); +test("rounding_flex_basis_overrides_main_size", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(113); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(64); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(64); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(64); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(64); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(24); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -323,72 +323,72 @@ it("rounding_flex_basis_overrides_main_size", function () { config.free(); } }); -it("rounding_total_fractial", function () { - var config = Yoga.Config.create(); +test("rounding_total_fractial", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(87.4); root.setHeight(113.4); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(0.7); root_child0.setFlexBasis(50.3); root_child0.setHeight(20.3); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1.6); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1.1); root_child2.setHeight(10.7); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(87 === root.getComputedWidth(), "87 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(87); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(87 === root_child0.getComputedWidth(), "87 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(59 === root_child0.getComputedHeight(), "59 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(87); + expect(root_child0.getComputedHeight()).toBe(59); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(59 === root_child1.getComputedTop(), "59 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(87 === root_child1.getComputedWidth(), "87 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(59); + expect(root_child1.getComputedWidth()).toBe(87); + expect(root_child1.getComputedHeight()).toBe(30); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(87); + expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(87 === root.getComputedWidth(), "87 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(87); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(87 === root_child0.getComputedWidth(), "87 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(59 === root_child0.getComputedHeight(), "59 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(87); + expect(root_child0.getComputedHeight()).toBe(59); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(59 === root_child1.getComputedTop(), "59 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(87 === root_child1.getComputedWidth(), "87 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(59); + expect(root_child1.getComputedWidth()).toBe(87); + expect(root_child1.getComputedHeight()).toBe(30); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(87); + expect(root_child2.getComputedHeight()).toBe(24); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -397,106 +397,106 @@ it("rounding_total_fractial", function () { config.free(); } }); -it("rounding_total_fractial_nested", function () { - var config = Yoga.Config.create(); +test("rounding_total_fractial_nested", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(87.4); root.setHeight(113.4); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(0.7); root_child0.setFlexBasis(50.3); root_child0.setHeight(20.3); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setFlexGrow(1); root_child0_child0.setFlexBasis(0.3); root_child0_child0.setPosition(Yoga.EDGE_BOTTOM, 13.3); root_child0_child0.setHeight(9.9); root_child0.insertChild(root_child0_child0, 0); - var root_child0_child1 = Yoga.Node.create(config); + const root_child0_child1 = Yoga.Node.create(config); root_child0_child1.setFlexGrow(4); root_child0_child1.setFlexBasis(0.3); root_child0_child1.setPosition(Yoga.EDGE_TOP, 13.3); root_child0_child1.setHeight(1.1); root_child0.insertChild(root_child0_child1, 1); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1.6); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1.1); root_child2.setHeight(10.7); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(87 === root.getComputedWidth(), "87 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(87); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(87 === root_child0.getComputedWidth(), "87 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(59 === root_child0.getComputedHeight(), "59 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(87); + expect(root_child0.getComputedHeight()).toBe(59); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(-13 === root_child0_child0.getComputedTop(), "-13 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(87 === root_child0_child0.getComputedWidth(), "87 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(12 === root_child0_child0.getComputedHeight(), "12 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(-13); + expect(root_child0_child0.getComputedWidth()).toBe(87); + expect(root_child0_child0.getComputedHeight()).toBe(12); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(25 === root_child0_child1.getComputedTop(), "25 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(87 === root_child0_child1.getComputedWidth(), "87 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(47 === root_child0_child1.getComputedHeight(), "47 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(25); + expect(root_child0_child1.getComputedWidth()).toBe(87); + expect(root_child0_child1.getComputedHeight()).toBe(47); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(59 === root_child1.getComputedTop(), "59 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(87 === root_child1.getComputedWidth(), "87 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(59); + expect(root_child1.getComputedWidth()).toBe(87); + expect(root_child1.getComputedHeight()).toBe(30); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(87); + expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(87 === root.getComputedWidth(), "87 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(87); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(87 === root_child0.getComputedWidth(), "87 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(59 === root_child0.getComputedHeight(), "59 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(87); + expect(root_child0.getComputedHeight()).toBe(59); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(-13 === root_child0_child0.getComputedTop(), "-13 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(87 === root_child0_child0.getComputedWidth(), "87 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(12 === root_child0_child0.getComputedHeight(), "12 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(-13); + expect(root_child0_child0.getComputedWidth()).toBe(87); + expect(root_child0_child0.getComputedHeight()).toBe(12); - console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")"); - console.assert(25 === root_child0_child1.getComputedTop(), "25 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")"); - console.assert(87 === root_child0_child1.getComputedWidth(), "87 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")"); - console.assert(47 === root_child0_child1.getComputedHeight(), "47 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")"); + expect(root_child0_child1.getComputedLeft()).toBe(0); + expect(root_child0_child1.getComputedTop()).toBe(25); + expect(root_child0_child1.getComputedWidth()).toBe(87); + expect(root_child0_child1.getComputedHeight()).toBe(47); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(59 === root_child1.getComputedTop(), "59 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(87 === root_child1.getComputedWidth(), "87 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(59); + expect(root_child1.getComputedWidth()).toBe(87); + expect(root_child1.getComputedHeight()).toBe(30); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(87); + expect(root_child2.getComputedHeight()).toBe(24); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -505,72 +505,72 @@ it("rounding_total_fractial_nested", function () { config.free(); } }); -it("rounding_fractial_input_1", function () { - var config = Yoga.Config.create(); +test("rounding_fractial_input_1", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(113.4); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(64); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(64); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(64); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(64); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(24); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -579,72 +579,72 @@ it("rounding_fractial_input_1", function () { config.free(); } }); -it("rounding_fractial_input_2", function () { - var config = Yoga.Config.create(); +test("rounding_fractial_input_2", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(113.6); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(114 === root.getComputedHeight(), "114 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(114); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(65); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(65 === root_child1.getComputedTop(), "65 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(65); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(24); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(25); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(114 === root.getComputedHeight(), "114 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(114); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(65); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(65 === root_child1.getComputedTop(), "65 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(65); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(24); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -653,73 +653,73 @@ it("rounding_fractial_input_2", function () { config.free(); } }); -it("rounding_fractial_input_3", function () { - var config = Yoga.Config.create(); +test("rounding_fractial_input_3", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setPosition(Yoga.EDGE_TOP, 0.3); root.setWidth(100); root.setHeight(113.4); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(114 === root.getComputedHeight(), "114 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(114); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(65); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(64); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(24); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(25); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(114 === root.getComputedHeight(), "114 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(114); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(65); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(64); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(24); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(25); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -728,73 +728,73 @@ it("rounding_fractial_input_3", function () { config.free(); } }); -it("rounding_fractial_input_4", function () { - var config = Yoga.Config.create(); +test("rounding_fractial_input_4", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setPosition(Yoga.EDGE_TOP, 0.7); root.setWidth(100); root.setHeight(113.4); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setFlexBasis(50); root_child0.setHeight(20); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(1 === root.getComputedTop(), "1 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(1); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(64); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(64); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(24); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(1 === root.getComputedTop(), "1 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(1); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(113); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(64); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(64); + expect(root_child1.getComputedWidth()).toBe(100); + expect(root_child1.getComputedHeight()).toBe(25); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(89); + expect(root_child2.getComputedWidth()).toBe(100); + expect(root_child2.getComputedHeight()).toBe(24); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -803,86 +803,86 @@ it("rounding_fractial_input_4", function () { config.free(); } }); -it("rounding_inner_node_controversy_horizontal", function () { - var config = Yoga.Config.create(); +test("rounding_inner_node_controversy_horizontal", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(320); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setHeight(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setHeight(10); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexGrow(1); root_child1_child0.setHeight(10); root_child1.insertChild(root_child1_child0, 0); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setHeight(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(320 === root.getComputedWidth(), "320 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(10 === root.getComputedHeight(), "10 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(320); + expect(root.getComputedHeight()).toBe(10); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(107 === root_child0.getComputedWidth(), "107 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(107); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(107 === root_child1.getComputedLeft(), "107 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(106 === root_child1.getComputedWidth(), "106 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(107); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(106); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(106 === root_child1_child0.getComputedWidth(), "106 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(106); + expect(root_child1_child0.getComputedHeight()).toBe(10); - console.assert(213 === root_child2.getComputedLeft(), "213 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(107 === root_child2.getComputedWidth(), "107 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(213); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(107); + expect(root_child2.getComputedHeight()).toBe(10); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(320 === root.getComputedWidth(), "320 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(10 === root.getComputedHeight(), "10 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(320); + expect(root.getComputedHeight()).toBe(10); - console.assert(213 === root_child0.getComputedLeft(), "213 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(107 === root_child0.getComputedWidth(), "107 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(213); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(107); + expect(root_child0.getComputedHeight()).toBe(10); - console.assert(107 === root_child1.getComputedLeft(), "107 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(106 === root_child1.getComputedWidth(), "106 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(107); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(106); + expect(root_child1.getComputedHeight()).toBe(10); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(106 === root_child1_child0.getComputedWidth(), "106 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(106); + expect(root_child1_child0.getComputedHeight()).toBe(10); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(107 === root_child2.getComputedWidth(), "107 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(107); + expect(root_child2.getComputedHeight()).toBe(10); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -891,85 +891,85 @@ it("rounding_inner_node_controversy_horizontal", function () { config.free(); } }); -it("rounding_inner_node_controversy_vertical", function () { - var config = Yoga.Config.create(); +test("rounding_inner_node_controversy_vertical", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setHeight(320); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setWidth(10); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setWidth(10); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexGrow(1); root_child1_child0.setWidth(10); root_child1.insertChild(root_child1_child0, 0); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setWidth(10); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(10 === root.getComputedWidth(), "10 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(10); + expect(root.getComputedHeight()).toBe(320); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(107 === root_child0.getComputedHeight(), "107 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(107); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(107 === root_child1.getComputedTop(), "107 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(106 === root_child1.getComputedHeight(), "106 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(107); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(106); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(10 === root_child1_child0.getComputedWidth(), "10 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(106 === root_child1_child0.getComputedHeight(), "106 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(10); + expect(root_child1_child0.getComputedHeight()).toBe(106); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(213 === root_child2.getComputedTop(), "213 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(107 === root_child2.getComputedHeight(), "107 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(213); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(107); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(10 === root.getComputedWidth(), "10 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(10); + expect(root.getComputedHeight()).toBe(320); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(107 === root_child0.getComputedHeight(), "107 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(10); + expect(root_child0.getComputedHeight()).toBe(107); - console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(107 === root_child1.getComputedTop(), "107 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(106 === root_child1.getComputedHeight(), "106 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(0); + expect(root_child1.getComputedTop()).toBe(107); + expect(root_child1.getComputedWidth()).toBe(10); + expect(root_child1.getComputedHeight()).toBe(106); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(10 === root_child1_child0.getComputedWidth(), "10 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(106 === root_child1_child0.getComputedHeight(), "106 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(10); + expect(root_child1_child0.getComputedHeight()).toBe(106); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(213 === root_child2.getComputedTop(), "213 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(107 === root_child2.getComputedHeight(), "107 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(213); + expect(root_child2.getComputedWidth()).toBe(10); + expect(root_child2.getComputedHeight()).toBe(107); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -978,132 +978,132 @@ it("rounding_inner_node_controversy_vertical", function () { config.free(); } }); -it("rounding_inner_node_controversy_combined", function () { - var config = Yoga.Config.create(); +test("rounding_inner_node_controversy_combined", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); root.setWidth(640); root.setHeight(320); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setFlexGrow(1); root_child0.setHeight("100%"); root.insertChild(root_child0, 0); - var root_child1 = Yoga.Node.create(config); + const root_child1 = Yoga.Node.create(config); root_child1.setFlexGrow(1); root_child1.setHeight("100%"); root.insertChild(root_child1, 1); - var root_child1_child0 = Yoga.Node.create(config); + const root_child1_child0 = Yoga.Node.create(config); root_child1_child0.setFlexGrow(1); root_child1_child0.setWidth("100%"); root_child1.insertChild(root_child1_child0, 0); - var root_child1_child1 = Yoga.Node.create(config); + const root_child1_child1 = Yoga.Node.create(config); root_child1_child1.setFlexGrow(1); root_child1_child1.setWidth("100%"); root_child1.insertChild(root_child1_child1, 1); - var root_child1_child1_child0 = Yoga.Node.create(config); + const root_child1_child1_child0 = Yoga.Node.create(config); root_child1_child1_child0.setFlexGrow(1); root_child1_child1_child0.setWidth("100%"); root_child1_child1.insertChild(root_child1_child1_child0, 0); - var root_child1_child2 = Yoga.Node.create(config); + const root_child1_child2 = Yoga.Node.create(config); root_child1_child2.setFlexGrow(1); root_child1_child2.setWidth("100%"); root_child1.insertChild(root_child1_child2, 2); - var root_child2 = Yoga.Node.create(config); + const root_child2 = Yoga.Node.create(config); root_child2.setFlexGrow(1); root_child2.setHeight("100%"); root.insertChild(root_child2, 2); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(640 === root.getComputedWidth(), "640 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(640); + expect(root.getComputedHeight()).toBe(320); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(213 === root_child0.getComputedWidth(), "213 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(320 === root_child0.getComputedHeight(), "320 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(213); + expect(root_child0.getComputedHeight()).toBe(320); - console.assert(213 === root_child1.getComputedLeft(), "213 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(214 === root_child1.getComputedWidth(), "214 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(320 === root_child1.getComputedHeight(), "320 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(213); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(214); + expect(root_child1.getComputedHeight()).toBe(320); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(214 === root_child1_child0.getComputedWidth(), "214 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(107 === root_child1_child0.getComputedHeight(), "107 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(214); + expect(root_child1_child0.getComputedHeight()).toBe(107); - console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")"); - console.assert(107 === root_child1_child1.getComputedTop(), "107 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")"); - console.assert(214 === root_child1_child1.getComputedWidth(), "214 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")"); - console.assert(106 === root_child1_child1.getComputedHeight(), "106 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")"); + expect(root_child1_child1.getComputedLeft()).toBe(0); + expect(root_child1_child1.getComputedTop()).toBe(107); + expect(root_child1_child1.getComputedWidth()).toBe(214); + expect(root_child1_child1.getComputedHeight()).toBe(106); - console.assert(0 === root_child1_child1_child0.getComputedLeft(), "0 === root_child1_child1_child0.getComputedLeft() (" + root_child1_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child1_child0.getComputedTop(), "0 === root_child1_child1_child0.getComputedTop() (" + root_child1_child1_child0.getComputedTop() + ")"); - console.assert(214 === root_child1_child1_child0.getComputedWidth(), "214 === root_child1_child1_child0.getComputedWidth() (" + root_child1_child1_child0.getComputedWidth() + ")"); - console.assert(106 === root_child1_child1_child0.getComputedHeight(), "106 === root_child1_child1_child0.getComputedHeight() (" + root_child1_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child1_child0.getComputedWidth()).toBe(214); + expect(root_child1_child1_child0.getComputedHeight()).toBe(106); - console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")"); - console.assert(213 === root_child1_child2.getComputedTop(), "213 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")"); - console.assert(214 === root_child1_child2.getComputedWidth(), "214 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")"); - console.assert(107 === root_child1_child2.getComputedHeight(), "107 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")"); + expect(root_child1_child2.getComputedLeft()).toBe(0); + expect(root_child1_child2.getComputedTop()).toBe(213); + expect(root_child1_child2.getComputedWidth()).toBe(214); + expect(root_child1_child2.getComputedHeight()).toBe(107); - console.assert(427 === root_child2.getComputedLeft(), "427 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(213 === root_child2.getComputedWidth(), "213 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(320 === root_child2.getComputedHeight(), "320 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(427); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(213); + expect(root_child2.getComputedHeight()).toBe(320); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(640 === root.getComputedWidth(), "640 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(640); + expect(root.getComputedHeight()).toBe(320); - console.assert(427 === root_child0.getComputedLeft(), "427 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(213 === root_child0.getComputedWidth(), "213 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(320 === root_child0.getComputedHeight(), "320 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(427); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(213); + expect(root_child0.getComputedHeight()).toBe(320); - console.assert(213 === root_child1.getComputedLeft(), "213 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")"); - console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")"); - console.assert(214 === root_child1.getComputedWidth(), "214 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")"); - console.assert(320 === root_child1.getComputedHeight(), "320 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")"); + expect(root_child1.getComputedLeft()).toBe(213); + expect(root_child1.getComputedTop()).toBe(0); + expect(root_child1.getComputedWidth()).toBe(214); + expect(root_child1.getComputedHeight()).toBe(320); - console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")"); - console.assert(214 === root_child1_child0.getComputedWidth(), "214 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")"); - console.assert(107 === root_child1_child0.getComputedHeight(), "107 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child0.getComputedWidth()).toBe(214); + expect(root_child1_child0.getComputedHeight()).toBe(107); - console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")"); - console.assert(107 === root_child1_child1.getComputedTop(), "107 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")"); - console.assert(214 === root_child1_child1.getComputedWidth(), "214 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")"); - console.assert(106 === root_child1_child1.getComputedHeight(), "106 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")"); + expect(root_child1_child1.getComputedLeft()).toBe(0); + expect(root_child1_child1.getComputedTop()).toBe(107); + expect(root_child1_child1.getComputedWidth()).toBe(214); + expect(root_child1_child1.getComputedHeight()).toBe(106); - console.assert(0 === root_child1_child1_child0.getComputedLeft(), "0 === root_child1_child1_child0.getComputedLeft() (" + root_child1_child1_child0.getComputedLeft() + ")"); - console.assert(0 === root_child1_child1_child0.getComputedTop(), "0 === root_child1_child1_child0.getComputedTop() (" + root_child1_child1_child0.getComputedTop() + ")"); - console.assert(214 === root_child1_child1_child0.getComputedWidth(), "214 === root_child1_child1_child0.getComputedWidth() (" + root_child1_child1_child0.getComputedWidth() + ")"); - console.assert(106 === root_child1_child1_child0.getComputedHeight(), "106 === root_child1_child1_child0.getComputedHeight() (" + root_child1_child1_child0.getComputedHeight() + ")"); + expect(root_child1_child1_child0.getComputedLeft()).toBe(0); + expect(root_child1_child1_child0.getComputedTop()).toBe(0); + expect(root_child1_child1_child0.getComputedWidth()).toBe(214); + expect(root_child1_child1_child0.getComputedHeight()).toBe(106); - console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")"); - console.assert(213 === root_child1_child2.getComputedTop(), "213 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")"); - console.assert(214 === root_child1_child2.getComputedWidth(), "214 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")"); - console.assert(107 === root_child1_child2.getComputedHeight(), "107 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")"); + expect(root_child1_child2.getComputedLeft()).toBe(0); + expect(root_child1_child2.getComputedTop()).toBe(213); + expect(root_child1_child2.getComputedWidth()).toBe(214); + expect(root_child1_child2.getComputedHeight()).toBe(107); - console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")"); - console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")"); - console.assert(213 === root_child2.getComputedWidth(), "213 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")"); - console.assert(320 === root_child2.getComputedHeight(), "320 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")"); + expect(root_child2.getComputedLeft()).toBe(0); + expect(root_child2.getComputedTop()).toBe(0); + expect(root_child2.getComputedWidth()).toBe(213); + expect(root_child2.getComputedHeight()).toBe(320); } finally { if (typeof root !== "undefined") { root.freeRecursive(); diff --git a/javascript/tests/generated/YGSizeOverflowTest.test.js b/javascript/tests/generated/YGSizeOverflowTest.test.js index 99b676a4..bd6e2dc3 100644 --- a/javascript/tests/generated/YGSizeOverflowTest.test.js +++ b/javascript/tests/generated/YGSizeOverflowTest.test.js @@ -7,54 +7,54 @@ // @generated by gentest/gentest.rb from gentest/fixtures/YGSizeOverflowTest.html -it("nested_overflowing_child", function () { - var config = Yoga.Config.create(); +test("nested_overflowing_child", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(200); root_child0_child0.setHeight(200); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(-100 === root_child0_child0.getComputedLeft(), "-100 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(-100); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -63,56 +63,56 @@ it("nested_overflowing_child", function () { config.free(); } }); -it("nested_overflowing_child_in_constraint_parent", function () { - var config = Yoga.Config.create(); +test("nested_overflowing_child_in_constraint_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root_child0.setHeight(100); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(200); root_child0_child0.setHeight(200); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(100); - console.assert(-100 === root_child0_child0.getComputedLeft(), "-100 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(200 === root_child0_child0.getComputedWidth(), "200 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(-100); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(200); + expect(root_child0_child0.getComputedHeight()).toBe(200); } finally { if (typeof root !== "undefined") { root.freeRecursive(); @@ -121,55 +121,55 @@ it("nested_overflowing_child_in_constraint_parent", function () { config.free(); } }); -it("parent_wrap_child_size_overflowing_parent", function () { - var config = Yoga.Config.create(); +test("parent_wrap_child_size_overflowing_parent", function () { + const config = Yoga.Config.create(); try { - var root = Yoga.Node.create(config); + const root = Yoga.Node.create(config); root.setWidth(100); root.setHeight(100); - var root_child0 = Yoga.Node.create(config); + const root_child0 = Yoga.Node.create(config); root_child0.setWidth(100); root.insertChild(root_child0, 0); - var root_child0_child0 = Yoga.Node.create(config); + const root_child0_child0 = Yoga.Node.create(config); root_child0_child0.setWidth(100); root_child0_child0.setHeight(200); root_child0.insertChild(root_child0_child0, 0); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(200); root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL); - console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")"); - console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")"); - console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")"); - console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")"); + expect(root.getComputedLeft()).toBe(0); + expect(root.getComputedTop()).toBe(0); + expect(root.getComputedWidth()).toBe(100); + expect(root.getComputedHeight()).toBe(100); - console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")"); - console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0.getComputedHeight(), "200 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")"); + expect(root_child0.getComputedLeft()).toBe(0); + expect(root_child0.getComputedTop()).toBe(0); + expect(root_child0.getComputedWidth()).toBe(100); + expect(root_child0.getComputedHeight()).toBe(200); - console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")"); - console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")"); - console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")"); - console.assert(200 === root_child0_child0.getComputedHeight(), "200 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")"); + expect(root_child0_child0.getComputedLeft()).toBe(0); + expect(root_child0_child0.getComputedTop()).toBe(0); + expect(root_child0_child0.getComputedWidth()).toBe(100); + expect(root_child0_child0.getComputedHeight()).toBe(200); } finally { if (typeof root !== "undefined") { root.freeRecursive();