How to use child2 method in ng-mocks

Best JavaScript code snippet using ng-mocks

YGRoundingTest.js

Source:YGRoundingTest.js Github

copy

Full Screen

1/**2 * Copyright (c) Facebook, Inc. and its affiliates.3 *4 * This source code is licensed under the MIT license found in the LICENSE5 * file in the root directory of this source tree.6 */7// @Generated by gentest/gentest.rb from gentest/fixtures/YGRoundingTest.html8var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY);9it("rounding_flex_basis_flex_grow_row_width_of_100", function () {10 var config = Yoga.Config.create();11 try {12 var root = Yoga.Node.create(config);13 root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);14 root.setWidth(100);15 root.setHeight(100);16 var root_child0 = Yoga.Node.create(config);17 root_child0.setFlexGrow(1);18 root.insertChild(root_child0, 0);19 var root_child1 = Yoga.Node.create(config);20 root_child1.setFlexGrow(1);21 root.insertChild(root_child1, 1);22 var root_child2 = Yoga.Node.create(config);23 root_child2.setFlexGrow(1);24 root.insertChild(root_child2, 2);25 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);26 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");27 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");28 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");29 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");30 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");31 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");32 console.assert(33 === root_child0.getComputedWidth(), "33 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");33 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");34 console.assert(33 === root_child1.getComputedLeft(), "33 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");35 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");36 console.assert(34 === root_child1.getComputedWidth(), "34 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");37 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");38 console.assert(67 === root_child2.getComputedLeft(), "67 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");39 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");40 console.assert(33 === root_child2.getComputedWidth(), "33 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");41 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");42 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);43 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");44 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");45 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");46 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");47 console.assert(67 === root_child0.getComputedLeft(), "67 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");48 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");49 console.assert(33 === root_child0.getComputedWidth(), "33 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");50 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");51 console.assert(33 === root_child1.getComputedLeft(), "33 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");52 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");53 console.assert(34 === root_child1.getComputedWidth(), "34 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");54 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");55 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");56 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");57 console.assert(33 === root_child2.getComputedWidth(), "33 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");58 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");59 } finally {60 if (typeof root !== "undefined") {61 root.freeRecursive();62 }63 config.free();64 }65});66it("rounding_flex_basis_flex_grow_row_prime_number_width", function () {67 var config = Yoga.Config.create();68 try {69 var root = Yoga.Node.create(config);70 root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);71 root.setWidth(113);72 root.setHeight(100);73 var root_child0 = Yoga.Node.create(config);74 root_child0.setFlexGrow(1);75 root.insertChild(root_child0, 0);76 var root_child1 = Yoga.Node.create(config);77 root_child1.setFlexGrow(1);78 root.insertChild(root_child1, 1);79 var root_child2 = Yoga.Node.create(config);80 root_child2.setFlexGrow(1);81 root.insertChild(root_child2, 2);82 var root_child3 = Yoga.Node.create(config);83 root_child3.setFlexGrow(1);84 root.insertChild(root_child3, 3);85 var root_child4 = Yoga.Node.create(config);86 root_child4.setFlexGrow(1);87 root.insertChild(root_child4, 4);88 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);89 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");90 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");91 console.assert(113 === root.getComputedWidth(), "113 === root.getComputedWidth() (" + root.getComputedWidth() + ")");92 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");93 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");94 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");95 console.assert(23 === root_child0.getComputedWidth(), "23 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");96 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");97 console.assert(23 === root_child1.getComputedLeft(), "23 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");98 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");99 console.assert(22 === root_child1.getComputedWidth(), "22 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");100 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");101 console.assert(45 === root_child2.getComputedLeft(), "45 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");102 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");103 console.assert(23 === root_child2.getComputedWidth(), "23 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");104 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");105 console.assert(68 === root_child3.getComputedLeft(), "68 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");106 console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");107 console.assert(22 === root_child3.getComputedWidth(), "22 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");108 console.assert(100 === root_child3.getComputedHeight(), "100 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");109 console.assert(90 === root_child4.getComputedLeft(), "90 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");110 console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");111 console.assert(23 === root_child4.getComputedWidth(), "23 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");112 console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");113 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);114 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");115 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");116 console.assert(113 === root.getComputedWidth(), "113 === root.getComputedWidth() (" + root.getComputedWidth() + ")");117 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");118 console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");119 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");120 console.assert(23 === root_child0.getComputedWidth(), "23 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");121 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");122 console.assert(68 === root_child1.getComputedLeft(), "68 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");123 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");124 console.assert(22 === root_child1.getComputedWidth(), "22 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");125 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");126 console.assert(45 === root_child2.getComputedLeft(), "45 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");127 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");128 console.assert(23 === root_child2.getComputedWidth(), "23 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");129 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");130 console.assert(23 === root_child3.getComputedLeft(), "23 === root_child3.getComputedLeft() (" + root_child3.getComputedLeft() + ")");131 console.assert(0 === root_child3.getComputedTop(), "0 === root_child3.getComputedTop() (" + root_child3.getComputedTop() + ")");132 console.assert(22 === root_child3.getComputedWidth(), "22 === root_child3.getComputedWidth() (" + root_child3.getComputedWidth() + ")");133 console.assert(100 === root_child3.getComputedHeight(), "100 === root_child3.getComputedHeight() (" + root_child3.getComputedHeight() + ")");134 console.assert(0 === root_child4.getComputedLeft(), "0 === root_child4.getComputedLeft() (" + root_child4.getComputedLeft() + ")");135 console.assert(0 === root_child4.getComputedTop(), "0 === root_child4.getComputedTop() (" + root_child4.getComputedTop() + ")");136 console.assert(23 === root_child4.getComputedWidth(), "23 === root_child4.getComputedWidth() (" + root_child4.getComputedWidth() + ")");137 console.assert(100 === root_child4.getComputedHeight(), "100 === root_child4.getComputedHeight() (" + root_child4.getComputedHeight() + ")");138 } finally {139 if (typeof root !== "undefined") {140 root.freeRecursive();141 }142 config.free();143 }144});145it("rounding_flex_basis_flex_shrink_row", function () {146 var config = Yoga.Config.create();147 try {148 var root = Yoga.Node.create(config);149 root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);150 root.setWidth(101);151 root.setHeight(100);152 var root_child0 = Yoga.Node.create(config);153 root_child0.setFlexShrink(1);154 root_child0.setFlexBasis(100);155 root.insertChild(root_child0, 0);156 var root_child1 = Yoga.Node.create(config);157 root_child1.setFlexBasis(25);158 root.insertChild(root_child1, 1);159 var root_child2 = Yoga.Node.create(config);160 root_child2.setFlexBasis(25);161 root.insertChild(root_child2, 2);162 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);163 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");164 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");165 console.assert(101 === root.getComputedWidth(), "101 === root.getComputedWidth() (" + root.getComputedWidth() + ")");166 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");167 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");168 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");169 console.assert(51 === root_child0.getComputedWidth(), "51 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");170 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");171 console.assert(51 === root_child1.getComputedLeft(), "51 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");172 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");173 console.assert(25 === root_child1.getComputedWidth(), "25 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");174 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");175 console.assert(76 === root_child2.getComputedLeft(), "76 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");176 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");177 console.assert(25 === root_child2.getComputedWidth(), "25 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");178 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");179 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);180 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");181 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");182 console.assert(101 === root.getComputedWidth(), "101 === root.getComputedWidth() (" + root.getComputedWidth() + ")");183 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");184 console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");185 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");186 console.assert(51 === root_child0.getComputedWidth(), "51 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");187 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");188 console.assert(25 === root_child1.getComputedLeft(), "25 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");189 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");190 console.assert(25 === root_child1.getComputedWidth(), "25 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");191 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");192 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");193 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");194 console.assert(25 === root_child2.getComputedWidth(), "25 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");195 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");196 } finally {197 if (typeof root !== "undefined") {198 root.freeRecursive();199 }200 config.free();201 }202});203it("rounding_flex_basis_overrides_main_size", function () {204 var config = Yoga.Config.create();205 try {206 var root = Yoga.Node.create(config);207 root.setWidth(100);208 root.setHeight(113);209 var root_child0 = Yoga.Node.create(config);210 root_child0.setFlexGrow(1);211 root_child0.setFlexBasis(50);212 root_child0.setHeight(20);213 root.insertChild(root_child0, 0);214 var root_child1 = Yoga.Node.create(config);215 root_child1.setFlexGrow(1);216 root_child1.setHeight(10);217 root.insertChild(root_child1, 1);218 var root_child2 = Yoga.Node.create(config);219 root_child2.setFlexGrow(1);220 root_child2.setHeight(10);221 root.insertChild(root_child2, 2);222 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);223 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");224 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");225 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");226 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");227 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");228 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");229 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");230 console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");231 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");232 console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");233 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");234 console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");235 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");236 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");237 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");238 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");239 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);240 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");241 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");242 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");243 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");244 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");245 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");246 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");247 console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");248 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");249 console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");250 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");251 console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");252 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");253 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");254 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");255 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");256 } finally {257 if (typeof root !== "undefined") {258 root.freeRecursive();259 }260 config.free();261 }262});263it("rounding_total_fractial", function () {264 var config = Yoga.Config.create();265 try {266 var root = Yoga.Node.create(config);267 root.setWidth(87.4);268 root.setHeight(113.4);269 var root_child0 = Yoga.Node.create(config);270 root_child0.setFlexGrow(0.7);271 root_child0.setFlexBasis(50.3);272 root_child0.setHeight(20.3);273 root.insertChild(root_child0, 0);274 var root_child1 = Yoga.Node.create(config);275 root_child1.setFlexGrow(1.6);276 root_child1.setHeight(10);277 root.insertChild(root_child1, 1);278 var root_child2 = Yoga.Node.create(config);279 root_child2.setFlexGrow(1.1);280 root_child2.setHeight(10.7);281 root.insertChild(root_child2, 2);282 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);283 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");284 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");285 console.assert(87 === root.getComputedWidth(), "87 === root.getComputedWidth() (" + root.getComputedWidth() + ")");286 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");287 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");288 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");289 console.assert(87 === root_child0.getComputedWidth(), "87 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");290 console.assert(59 === root_child0.getComputedHeight(), "59 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");291 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");292 console.assert(59 === root_child1.getComputedTop(), "59 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");293 console.assert(87 === root_child1.getComputedWidth(), "87 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");294 console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");295 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");296 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");297 console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");298 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");299 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);300 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");301 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");302 console.assert(87 === root.getComputedWidth(), "87 === root.getComputedWidth() (" + root.getComputedWidth() + ")");303 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");304 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");305 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");306 console.assert(87 === root_child0.getComputedWidth(), "87 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");307 console.assert(59 === root_child0.getComputedHeight(), "59 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");308 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");309 console.assert(59 === root_child1.getComputedTop(), "59 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");310 console.assert(87 === root_child1.getComputedWidth(), "87 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");311 console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");312 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");313 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");314 console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");315 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");316 } finally {317 if (typeof root !== "undefined") {318 root.freeRecursive();319 }320 config.free();321 }322});323it("rounding_total_fractial_nested", function () {324 var config = Yoga.Config.create();325 try {326 var root = Yoga.Node.create(config);327 root.setWidth(87.4);328 root.setHeight(113.4);329 var root_child0 = Yoga.Node.create(config);330 root_child0.setFlexGrow(0.7);331 root_child0.setFlexBasis(50.3);332 root_child0.setHeight(20.3);333 root.insertChild(root_child0, 0);334 var root_child0_child0 = Yoga.Node.create(config);335 root_child0_child0.setFlexGrow(1);336 root_child0_child0.setFlexBasis(0.3);337 root_child0_child0.setPosition(Yoga.EDGE_BOTTOM, 13.3);338 root_child0_child0.setHeight(9.9);339 root_child0.insertChild(root_child0_child0, 0);340 var root_child0_child1 = Yoga.Node.create(config);341 root_child0_child1.setFlexGrow(4);342 root_child0_child1.setFlexBasis(0.3);343 root_child0_child1.setPosition(Yoga.EDGE_TOP, 13.3);344 root_child0_child1.setHeight(1.1);345 root_child0.insertChild(root_child0_child1, 1);346 var root_child1 = Yoga.Node.create(config);347 root_child1.setFlexGrow(1.6);348 root_child1.setHeight(10);349 root.insertChild(root_child1, 1);350 var root_child2 = Yoga.Node.create(config);351 root_child2.setFlexGrow(1.1);352 root_child2.setHeight(10.7);353 root.insertChild(root_child2, 2);354 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);355 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");356 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");357 console.assert(87 === root.getComputedWidth(), "87 === root.getComputedWidth() (" + root.getComputedWidth() + ")");358 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");359 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");360 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");361 console.assert(87 === root_child0.getComputedWidth(), "87 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");362 console.assert(59 === root_child0.getComputedHeight(), "59 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");363 console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");364 console.assert(-13 === root_child0_child0.getComputedTop(), "-13 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");365 console.assert(87 === root_child0_child0.getComputedWidth(), "87 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");366 console.assert(12 === root_child0_child0.getComputedHeight(), "12 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");367 console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")");368 console.assert(25 === root_child0_child1.getComputedTop(), "25 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")");369 console.assert(87 === root_child0_child1.getComputedWidth(), "87 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")");370 console.assert(47 === root_child0_child1.getComputedHeight(), "47 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")");371 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");372 console.assert(59 === root_child1.getComputedTop(), "59 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");373 console.assert(87 === root_child1.getComputedWidth(), "87 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");374 console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");375 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");376 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");377 console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");378 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");379 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);380 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");381 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");382 console.assert(87 === root.getComputedWidth(), "87 === root.getComputedWidth() (" + root.getComputedWidth() + ")");383 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");384 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");385 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");386 console.assert(87 === root_child0.getComputedWidth(), "87 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");387 console.assert(59 === root_child0.getComputedHeight(), "59 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");388 console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");389 console.assert(-13 === root_child0_child0.getComputedTop(), "-13 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");390 console.assert(87 === root_child0_child0.getComputedWidth(), "87 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");391 console.assert(12 === root_child0_child0.getComputedHeight(), "12 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");392 console.assert(0 === root_child0_child1.getComputedLeft(), "0 === root_child0_child1.getComputedLeft() (" + root_child0_child1.getComputedLeft() + ")");393 console.assert(25 === root_child0_child1.getComputedTop(), "25 === root_child0_child1.getComputedTop() (" + root_child0_child1.getComputedTop() + ")");394 console.assert(87 === root_child0_child1.getComputedWidth(), "87 === root_child0_child1.getComputedWidth() (" + root_child0_child1.getComputedWidth() + ")");395 console.assert(47 === root_child0_child1.getComputedHeight(), "47 === root_child0_child1.getComputedHeight() (" + root_child0_child1.getComputedHeight() + ")");396 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");397 console.assert(59 === root_child1.getComputedTop(), "59 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");398 console.assert(87 === root_child1.getComputedWidth(), "87 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");399 console.assert(30 === root_child1.getComputedHeight(), "30 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");400 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");401 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");402 console.assert(87 === root_child2.getComputedWidth(), "87 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");403 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");404 } finally {405 if (typeof root !== "undefined") {406 root.freeRecursive();407 }408 config.free();409 }410});411it("rounding_fractial_input_1", function () {412 var config = Yoga.Config.create();413 try {414 var root = Yoga.Node.create(config);415 root.setWidth(100);416 root.setHeight(113.4);417 var root_child0 = Yoga.Node.create(config);418 root_child0.setFlexGrow(1);419 root_child0.setFlexBasis(50);420 root_child0.setHeight(20);421 root.insertChild(root_child0, 0);422 var root_child1 = Yoga.Node.create(config);423 root_child1.setFlexGrow(1);424 root_child1.setHeight(10);425 root.insertChild(root_child1, 1);426 var root_child2 = Yoga.Node.create(config);427 root_child2.setFlexGrow(1);428 root_child2.setHeight(10);429 root.insertChild(root_child2, 2);430 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);431 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");432 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");433 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");434 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");435 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");436 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");437 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");438 console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");439 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");440 console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");441 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");442 console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");443 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");444 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");445 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");446 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");447 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);448 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");449 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");450 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");451 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");452 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");453 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");454 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");455 console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");456 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");457 console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");458 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");459 console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");460 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");461 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");462 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");463 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");464 } finally {465 if (typeof root !== "undefined") {466 root.freeRecursive();467 }468 config.free();469 }470});471it("rounding_fractial_input_2", function () {472 var config = Yoga.Config.create();473 try {474 var root = Yoga.Node.create(config);475 root.setWidth(100);476 root.setHeight(113.6);477 var root_child0 = Yoga.Node.create(config);478 root_child0.setFlexGrow(1);479 root_child0.setFlexBasis(50);480 root_child0.setHeight(20);481 root.insertChild(root_child0, 0);482 var root_child1 = Yoga.Node.create(config);483 root_child1.setFlexGrow(1);484 root_child1.setHeight(10);485 root.insertChild(root_child1, 1);486 var root_child2 = Yoga.Node.create(config);487 root_child2.setFlexGrow(1);488 root_child2.setHeight(10);489 root.insertChild(root_child2, 2);490 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);491 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");492 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");493 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");494 console.assert(114 === root.getComputedHeight(), "114 === root.getComputedHeight() (" + root.getComputedHeight() + ")");495 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");496 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");497 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");498 console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");499 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");500 console.assert(65 === root_child1.getComputedTop(), "65 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");501 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");502 console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");503 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");504 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");505 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");506 console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");507 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);508 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");509 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");510 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");511 console.assert(114 === root.getComputedHeight(), "114 === root.getComputedHeight() (" + root.getComputedHeight() + ")");512 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");513 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");514 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");515 console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");516 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");517 console.assert(65 === root_child1.getComputedTop(), "65 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");518 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");519 console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");520 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");521 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");522 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");523 console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");524 } finally {525 if (typeof root !== "undefined") {526 root.freeRecursive();527 }528 config.free();529 }530});531it("rounding_fractial_input_3", function () {532 var config = Yoga.Config.create();533 try {534 var root = Yoga.Node.create(config);535 root.setPosition(Yoga.EDGE_TOP, 0.3);536 root.setWidth(100);537 root.setHeight(113.4);538 var root_child0 = Yoga.Node.create(config);539 root_child0.setFlexGrow(1);540 root_child0.setFlexBasis(50);541 root_child0.setHeight(20);542 root.insertChild(root_child0, 0);543 var root_child1 = Yoga.Node.create(config);544 root_child1.setFlexGrow(1);545 root_child1.setHeight(10);546 root.insertChild(root_child1, 1);547 var root_child2 = Yoga.Node.create(config);548 root_child2.setFlexGrow(1);549 root_child2.setHeight(10);550 root.insertChild(root_child2, 2);551 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);552 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");553 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");554 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");555 console.assert(114 === root.getComputedHeight(), "114 === root.getComputedHeight() (" + root.getComputedHeight() + ")");556 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");557 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");558 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");559 console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");560 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");561 console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");562 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");563 console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");564 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");565 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");566 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");567 console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");568 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);569 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");570 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");571 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");572 console.assert(114 === root.getComputedHeight(), "114 === root.getComputedHeight() (" + root.getComputedHeight() + ")");573 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");574 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");575 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");576 console.assert(65 === root_child0.getComputedHeight(), "65 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");577 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");578 console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");579 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");580 console.assert(24 === root_child1.getComputedHeight(), "24 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");581 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");582 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");583 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");584 console.assert(25 === root_child2.getComputedHeight(), "25 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");585 } finally {586 if (typeof root !== "undefined") {587 root.freeRecursive();588 }589 config.free();590 }591});592it("rounding_fractial_input_4", function () {593 var config = Yoga.Config.create();594 try {595 var root = Yoga.Node.create(config);596 root.setPosition(Yoga.EDGE_TOP, 0.7);597 root.setWidth(100);598 root.setHeight(113.4);599 var root_child0 = Yoga.Node.create(config);600 root_child0.setFlexGrow(1);601 root_child0.setFlexBasis(50);602 root_child0.setHeight(20);603 root.insertChild(root_child0, 0);604 var root_child1 = Yoga.Node.create(config);605 root_child1.setFlexGrow(1);606 root_child1.setHeight(10);607 root.insertChild(root_child1, 1);608 var root_child2 = Yoga.Node.create(config);609 root_child2.setFlexGrow(1);610 root_child2.setHeight(10);611 root.insertChild(root_child2, 2);612 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);613 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");614 console.assert(1 === root.getComputedTop(), "1 === root.getComputedTop() (" + root.getComputedTop() + ")");615 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");616 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");617 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");618 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");619 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");620 console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");621 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");622 console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");623 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");624 console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");625 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");626 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");627 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");628 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");629 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);630 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");631 console.assert(1 === root.getComputedTop(), "1 === root.getComputedTop() (" + root.getComputedTop() + ")");632 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");633 console.assert(113 === root.getComputedHeight(), "113 === root.getComputedHeight() (" + root.getComputedHeight() + ")");634 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");635 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");636 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");637 console.assert(64 === root_child0.getComputedHeight(), "64 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");638 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");639 console.assert(64 === root_child1.getComputedTop(), "64 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");640 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");641 console.assert(25 === root_child1.getComputedHeight(), "25 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");642 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");643 console.assert(89 === root_child2.getComputedTop(), "89 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");644 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");645 console.assert(24 === root_child2.getComputedHeight(), "24 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");646 } finally {647 if (typeof root !== "undefined") {648 root.freeRecursive();649 }650 config.free();651 }652});653it("rounding_inner_node_controversy_horizontal", function () {654 var config = Yoga.Config.create();655 try {656 var root = Yoga.Node.create(config);657 root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);658 root.setWidth(320);659 var root_child0 = Yoga.Node.create(config);660 root_child0.setFlexGrow(1);661 root_child0.setHeight(10);662 root.insertChild(root_child0, 0);663 var root_child1 = Yoga.Node.create(config);664 root_child1.setFlexGrow(1);665 root_child1.setHeight(10);666 root.insertChild(root_child1, 1);667 var root_child1_child0 = Yoga.Node.create(config);668 root_child1_child0.setFlexGrow(1);669 root_child1_child0.setHeight(10);670 root_child1.insertChild(root_child1_child0, 0);671 var root_child2 = Yoga.Node.create(config);672 root_child2.setFlexGrow(1);673 root_child2.setHeight(10);674 root.insertChild(root_child2, 2);675 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);676 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");677 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");678 console.assert(320 === root.getComputedWidth(), "320 === root.getComputedWidth() (" + root.getComputedWidth() + ")");679 console.assert(10 === root.getComputedHeight(), "10 === root.getComputedHeight() (" + root.getComputedHeight() + ")");680 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");681 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");682 console.assert(107 === root_child0.getComputedWidth(), "107 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");683 console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");684 console.assert(107 === root_child1.getComputedLeft(), "107 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");685 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");686 console.assert(106 === root_child1.getComputedWidth(), "106 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");687 console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");688 console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");689 console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");690 console.assert(106 === root_child1_child0.getComputedWidth(), "106 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");691 console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");692 console.assert(213 === root_child2.getComputedLeft(), "213 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");693 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");694 console.assert(107 === root_child2.getComputedWidth(), "107 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");695 console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");696 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);697 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");698 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");699 console.assert(320 === root.getComputedWidth(), "320 === root.getComputedWidth() (" + root.getComputedWidth() + ")");700 console.assert(10 === root.getComputedHeight(), "10 === root.getComputedHeight() (" + root.getComputedHeight() + ")");701 console.assert(213 === root_child0.getComputedLeft(), "213 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");702 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");703 console.assert(107 === root_child0.getComputedWidth(), "107 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");704 console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");705 console.assert(107 === root_child1.getComputedLeft(), "107 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");706 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");707 console.assert(106 === root_child1.getComputedWidth(), "106 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");708 console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");709 console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");710 console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");711 console.assert(106 === root_child1_child0.getComputedWidth(), "106 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");712 console.assert(10 === root_child1_child0.getComputedHeight(), "10 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");713 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");714 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");715 console.assert(107 === root_child2.getComputedWidth(), "107 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");716 console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");717 } finally {718 if (typeof root !== "undefined") {719 root.freeRecursive();720 }721 config.free();722 }723});724it("rounding_inner_node_controversy_vertical", function () {725 var config = Yoga.Config.create();726 try {727 var root = Yoga.Node.create(config);728 root.setHeight(320);729 var root_child0 = Yoga.Node.create(config);730 root_child0.setFlexGrow(1);731 root_child0.setWidth(10);732 root.insertChild(root_child0, 0);733 var root_child1 = Yoga.Node.create(config);734 root_child1.setFlexGrow(1);735 root_child1.setWidth(10);736 root.insertChild(root_child1, 1);737 var root_child1_child0 = Yoga.Node.create(config);738 root_child1_child0.setFlexGrow(1);739 root_child1_child0.setWidth(10);740 root_child1.insertChild(root_child1_child0, 0);741 var root_child2 = Yoga.Node.create(config);742 root_child2.setFlexGrow(1);743 root_child2.setWidth(10);744 root.insertChild(root_child2, 2);745 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);746 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");747 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");748 console.assert(10 === root.getComputedWidth(), "10 === root.getComputedWidth() (" + root.getComputedWidth() + ")");749 console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")");750 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");751 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");752 console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");753 console.assert(107 === root_child0.getComputedHeight(), "107 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");754 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");755 console.assert(107 === root_child1.getComputedTop(), "107 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");756 console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");757 console.assert(106 === root_child1.getComputedHeight(), "106 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");758 console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");759 console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");760 console.assert(10 === root_child1_child0.getComputedWidth(), "10 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");761 console.assert(106 === root_child1_child0.getComputedHeight(), "106 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");762 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");763 console.assert(213 === root_child2.getComputedTop(), "213 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");764 console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");765 console.assert(107 === root_child2.getComputedHeight(), "107 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");766 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);767 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");768 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");769 console.assert(10 === root.getComputedWidth(), "10 === root.getComputedWidth() (" + root.getComputedWidth() + ")");770 console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")");771 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");772 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");773 console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");774 console.assert(107 === root_child0.getComputedHeight(), "107 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");775 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");776 console.assert(107 === root_child1.getComputedTop(), "107 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");777 console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");778 console.assert(106 === root_child1.getComputedHeight(), "106 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");779 console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");780 console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");781 console.assert(10 === root_child1_child0.getComputedWidth(), "10 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");782 console.assert(106 === root_child1_child0.getComputedHeight(), "106 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");783 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");784 console.assert(213 === root_child2.getComputedTop(), "213 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");785 console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");786 console.assert(107 === root_child2.getComputedHeight(), "107 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");787 } finally {788 if (typeof root !== "undefined") {789 root.freeRecursive();790 }791 config.free();792 }793});794it("rounding_inner_node_controversy_combined", function () {795 var config = Yoga.Config.create();796 try {797 var root = Yoga.Node.create(config);798 root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);799 root.setWidth(640);800 root.setHeight(320);801 var root_child0 = Yoga.Node.create(config);802 root_child0.setFlexGrow(1);803 root_child0.setHeight("100%");804 root.insertChild(root_child0, 0);805 var root_child1 = Yoga.Node.create(config);806 root_child1.setFlexGrow(1);807 root_child1.setHeight("100%");808 root.insertChild(root_child1, 1);809 var root_child1_child0 = Yoga.Node.create(config);810 root_child1_child0.setFlexGrow(1);811 root_child1_child0.setWidth("100%");812 root_child1.insertChild(root_child1_child0, 0);813 var root_child1_child1 = Yoga.Node.create(config);814 root_child1_child1.setFlexGrow(1);815 root_child1_child1.setWidth("100%");816 root_child1.insertChild(root_child1_child1, 1);817 var root_child1_child1_child0 = Yoga.Node.create(config);818 root_child1_child1_child0.setFlexGrow(1);819 root_child1_child1_child0.setWidth("100%");820 root_child1_child1.insertChild(root_child1_child1_child0, 0);821 var root_child1_child2 = Yoga.Node.create(config);822 root_child1_child2.setFlexGrow(1);823 root_child1_child2.setWidth("100%");824 root_child1.insertChild(root_child1_child2, 2);825 var root_child2 = Yoga.Node.create(config);826 root_child2.setFlexGrow(1);827 root_child2.setHeight("100%");828 root.insertChild(root_child2, 2);829 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);830 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");831 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");832 console.assert(640 === root.getComputedWidth(), "640 === root.getComputedWidth() (" + root.getComputedWidth() + ")");833 console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")");834 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");835 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");836 console.assert(213 === root_child0.getComputedWidth(), "213 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");837 console.assert(320 === root_child0.getComputedHeight(), "320 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");838 console.assert(213 === root_child1.getComputedLeft(), "213 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");839 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");840 console.assert(214 === root_child1.getComputedWidth(), "214 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");841 console.assert(320 === root_child1.getComputedHeight(), "320 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");842 console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");843 console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");844 console.assert(214 === root_child1_child0.getComputedWidth(), "214 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");845 console.assert(107 === root_child1_child0.getComputedHeight(), "107 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");846 console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")");847 console.assert(107 === root_child1_child1.getComputedTop(), "107 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")");848 console.assert(214 === root_child1_child1.getComputedWidth(), "214 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")");849 console.assert(106 === root_child1_child1.getComputedHeight(), "106 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")");850 console.assert(0 === root_child1_child1_child0.getComputedLeft(), "0 === root_child1_child1_child0.getComputedLeft() (" + root_child1_child1_child0.getComputedLeft() + ")");851 console.assert(0 === root_child1_child1_child0.getComputedTop(), "0 === root_child1_child1_child0.getComputedTop() (" + root_child1_child1_child0.getComputedTop() + ")");852 console.assert(214 === root_child1_child1_child0.getComputedWidth(), "214 === root_child1_child1_child0.getComputedWidth() (" + root_child1_child1_child0.getComputedWidth() + ")");853 console.assert(106 === root_child1_child1_child0.getComputedHeight(), "106 === root_child1_child1_child0.getComputedHeight() (" + root_child1_child1_child0.getComputedHeight() + ")");854 console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")");855 console.assert(213 === root_child1_child2.getComputedTop(), "213 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")");856 console.assert(214 === root_child1_child2.getComputedWidth(), "214 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")");857 console.assert(107 === root_child1_child2.getComputedHeight(), "107 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")");858 console.assert(427 === root_child2.getComputedLeft(), "427 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");859 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");860 console.assert(213 === root_child2.getComputedWidth(), "213 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");861 console.assert(320 === root_child2.getComputedHeight(), "320 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");862 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);863 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");864 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");865 console.assert(640 === root.getComputedWidth(), "640 === root.getComputedWidth() (" + root.getComputedWidth() + ")");866 console.assert(320 === root.getComputedHeight(), "320 === root.getComputedHeight() (" + root.getComputedHeight() + ")");867 console.assert(427 === root_child0.getComputedLeft(), "427 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");868 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");869 console.assert(213 === root_child0.getComputedWidth(), "213 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");870 console.assert(320 === root_child0.getComputedHeight(), "320 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");871 console.assert(213 === root_child1.getComputedLeft(), "213 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");872 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");873 console.assert(214 === root_child1.getComputedWidth(), "214 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");874 console.assert(320 === root_child1.getComputedHeight(), "320 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");875 console.assert(0 === root_child1_child0.getComputedLeft(), "0 === root_child1_child0.getComputedLeft() (" + root_child1_child0.getComputedLeft() + ")");876 console.assert(0 === root_child1_child0.getComputedTop(), "0 === root_child1_child0.getComputedTop() (" + root_child1_child0.getComputedTop() + ")");877 console.assert(214 === root_child1_child0.getComputedWidth(), "214 === root_child1_child0.getComputedWidth() (" + root_child1_child0.getComputedWidth() + ")");878 console.assert(107 === root_child1_child0.getComputedHeight(), "107 === root_child1_child0.getComputedHeight() (" + root_child1_child0.getComputedHeight() + ")");879 console.assert(0 === root_child1_child1.getComputedLeft(), "0 === root_child1_child1.getComputedLeft() (" + root_child1_child1.getComputedLeft() + ")");880 console.assert(107 === root_child1_child1.getComputedTop(), "107 === root_child1_child1.getComputedTop() (" + root_child1_child1.getComputedTop() + ")");881 console.assert(214 === root_child1_child1.getComputedWidth(), "214 === root_child1_child1.getComputedWidth() (" + root_child1_child1.getComputedWidth() + ")");882 console.assert(106 === root_child1_child1.getComputedHeight(), "106 === root_child1_child1.getComputedHeight() (" + root_child1_child1.getComputedHeight() + ")");883 console.assert(0 === root_child1_child1_child0.getComputedLeft(), "0 === root_child1_child1_child0.getComputedLeft() (" + root_child1_child1_child0.getComputedLeft() + ")");884 console.assert(0 === root_child1_child1_child0.getComputedTop(), "0 === root_child1_child1_child0.getComputedTop() (" + root_child1_child1_child0.getComputedTop() + ")");885 console.assert(214 === root_child1_child1_child0.getComputedWidth(), "214 === root_child1_child1_child0.getComputedWidth() (" + root_child1_child1_child0.getComputedWidth() + ")");886 console.assert(106 === root_child1_child1_child0.getComputedHeight(), "106 === root_child1_child1_child0.getComputedHeight() (" + root_child1_child1_child0.getComputedHeight() + ")");887 console.assert(0 === root_child1_child2.getComputedLeft(), "0 === root_child1_child2.getComputedLeft() (" + root_child1_child2.getComputedLeft() + ")");888 console.assert(213 === root_child1_child2.getComputedTop(), "213 === root_child1_child2.getComputedTop() (" + root_child1_child2.getComputedTop() + ")");889 console.assert(214 === root_child1_child2.getComputedWidth(), "214 === root_child1_child2.getComputedWidth() (" + root_child1_child2.getComputedWidth() + ")");890 console.assert(107 === root_child1_child2.getComputedHeight(), "107 === root_child1_child2.getComputedHeight() (" + root_child1_child2.getComputedHeight() + ")");891 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");892 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");893 console.assert(213 === root_child2.getComputedWidth(), "213 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");894 console.assert(320 === root_child2.getComputedHeight(), "320 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");895 } finally {896 if (typeof root !== "undefined") {897 root.freeRecursive();898 }899 config.free();900 }...

Full Screen

Full Screen

YGFlexDirectionTest.js

Source:YGFlexDirectionTest.js Github

copy

Full Screen

1/**2 * Copyright (c) Facebook, Inc. and its affiliates.3 *4 * This source code is licensed under the MIT license found in the LICENSE5 * file in the root directory of this source tree.6 */7// @Generated by gentest/gentest.rb from gentest/fixtures/YGFlexDirectionTest.html8var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY);9it("flex_direction_column_no_height", function () {10 var config = Yoga.Config.create();11 try {12 var root = Yoga.Node.create(config);13 root.setWidth(100);14 var root_child0 = Yoga.Node.create(config);15 root_child0.setHeight(10);16 root.insertChild(root_child0, 0);17 var root_child1 = Yoga.Node.create(config);18 root_child1.setHeight(10);19 root.insertChild(root_child1, 1);20 var root_child2 = Yoga.Node.create(config);21 root_child2.setHeight(10);22 root.insertChild(root_child2, 2);23 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);24 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");25 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");26 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");27 console.assert(30 === root.getComputedHeight(), "30 === root.getComputedHeight() (" + root.getComputedHeight() + ")");28 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");29 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");30 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");31 console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");32 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");33 console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");34 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");35 console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");36 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");37 console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");38 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");39 console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");40 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);41 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");42 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");43 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");44 console.assert(30 === root.getComputedHeight(), "30 === root.getComputedHeight() (" + root.getComputedHeight() + ")");45 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");46 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");47 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");48 console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");49 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");50 console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");51 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");52 console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");53 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");54 console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");55 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");56 console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");57 } finally {58 if (typeof root !== "undefined") {59 root.freeRecursive();60 }61 config.free();62 }63});64it("flex_direction_row_no_width", function () {65 var config = Yoga.Config.create();66 try {67 var root = Yoga.Node.create(config);68 root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);69 root.setHeight(100);70 var root_child0 = Yoga.Node.create(config);71 root_child0.setWidth(10);72 root.insertChild(root_child0, 0);73 var root_child1 = Yoga.Node.create(config);74 root_child1.setWidth(10);75 root.insertChild(root_child1, 1);76 var root_child2 = Yoga.Node.create(config);77 root_child2.setWidth(10);78 root.insertChild(root_child2, 2);79 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);80 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");81 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");82 console.assert(30 === root.getComputedWidth(), "30 === root.getComputedWidth() (" + root.getComputedWidth() + ")");83 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");84 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");85 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");86 console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");87 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");88 console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");89 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");90 console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");91 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");92 console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");93 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");94 console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");95 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");96 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);97 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");98 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");99 console.assert(30 === root.getComputedWidth(), "30 === root.getComputedWidth() (" + root.getComputedWidth() + ")");100 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");101 console.assert(20 === root_child0.getComputedLeft(), "20 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");102 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");103 console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");104 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");105 console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");106 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");107 console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");108 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");109 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");110 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");111 console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");112 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");113 } finally {114 if (typeof root !== "undefined") {115 root.freeRecursive();116 }117 config.free();118 }119});120it("flex_direction_column", function () {121 var config = Yoga.Config.create();122 try {123 var root = Yoga.Node.create(config);124 root.setWidth(100);125 root.setHeight(100);126 var root_child0 = Yoga.Node.create(config);127 root_child0.setHeight(10);128 root.insertChild(root_child0, 0);129 var root_child1 = Yoga.Node.create(config);130 root_child1.setHeight(10);131 root.insertChild(root_child1, 1);132 var root_child2 = Yoga.Node.create(config);133 root_child2.setHeight(10);134 root.insertChild(root_child2, 2);135 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);136 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");137 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");138 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");139 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");140 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");141 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");142 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");143 console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");144 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");145 console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");146 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");147 console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");148 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");149 console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");150 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");151 console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");152 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);153 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");154 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");155 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");156 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");157 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");158 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");159 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");160 console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");161 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");162 console.assert(10 === root_child1.getComputedTop(), "10 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");163 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");164 console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");165 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");166 console.assert(20 === root_child2.getComputedTop(), "20 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");167 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");168 console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");169 } finally {170 if (typeof root !== "undefined") {171 root.freeRecursive();172 }173 config.free();174 }175});176it("flex_direction_row", function () {177 var config = Yoga.Config.create();178 try {179 var root = Yoga.Node.create(config);180 root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);181 root.setWidth(100);182 root.setHeight(100);183 var root_child0 = Yoga.Node.create(config);184 root_child0.setWidth(10);185 root.insertChild(root_child0, 0);186 var root_child1 = Yoga.Node.create(config);187 root_child1.setWidth(10);188 root.insertChild(root_child1, 1);189 var root_child2 = Yoga.Node.create(config);190 root_child2.setWidth(10);191 root.insertChild(root_child2, 2);192 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);193 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");194 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");195 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");196 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");197 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");198 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");199 console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");200 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");201 console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");202 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");203 console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");204 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");205 console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");206 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");207 console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");208 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");209 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);210 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");211 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");212 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");213 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");214 console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");215 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");216 console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");217 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");218 console.assert(80 === root_child1.getComputedLeft(), "80 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");219 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");220 console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");221 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");222 console.assert(70 === root_child2.getComputedLeft(), "70 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");223 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");224 console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");225 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");226 } finally {227 if (typeof root !== "undefined") {228 root.freeRecursive();229 }230 config.free();231 }232});233it("flex_direction_column_reverse", function () {234 var config = Yoga.Config.create();235 try {236 var root = Yoga.Node.create(config);237 root.setFlexDirection(Yoga.FLEX_DIRECTION_COLUMN_REVERSE);238 root.setWidth(100);239 root.setHeight(100);240 var root_child0 = Yoga.Node.create(config);241 root_child0.setHeight(10);242 root.insertChild(root_child0, 0);243 var root_child1 = Yoga.Node.create(config);244 root_child1.setHeight(10);245 root.insertChild(root_child1, 1);246 var root_child2 = Yoga.Node.create(config);247 root_child2.setHeight(10);248 root.insertChild(root_child2, 2);249 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);250 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");251 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");252 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");253 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");254 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");255 console.assert(90 === root_child0.getComputedTop(), "90 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");256 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");257 console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");258 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");259 console.assert(80 === root_child1.getComputedTop(), "80 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");260 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");261 console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");262 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");263 console.assert(70 === root_child2.getComputedTop(), "70 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");264 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");265 console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");266 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);267 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");268 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");269 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");270 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");271 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");272 console.assert(90 === root_child0.getComputedTop(), "90 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");273 console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");274 console.assert(10 === root_child0.getComputedHeight(), "10 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");275 console.assert(0 === root_child1.getComputedLeft(), "0 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");276 console.assert(80 === root_child1.getComputedTop(), "80 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");277 console.assert(100 === root_child1.getComputedWidth(), "100 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");278 console.assert(10 === root_child1.getComputedHeight(), "10 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");279 console.assert(0 === root_child2.getComputedLeft(), "0 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");280 console.assert(70 === root_child2.getComputedTop(), "70 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");281 console.assert(100 === root_child2.getComputedWidth(), "100 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");282 console.assert(10 === root_child2.getComputedHeight(), "10 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");283 } finally {284 if (typeof root !== "undefined") {285 root.freeRecursive();286 }287 config.free();288 }289});290it("flex_direction_row_reverse", function () {291 var config = Yoga.Config.create();292 try {293 var root = Yoga.Node.create(config);294 root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW_REVERSE);295 root.setWidth(100);296 root.setHeight(100);297 var root_child0 = Yoga.Node.create(config);298 root_child0.setWidth(10);299 root.insertChild(root_child0, 0);300 var root_child1 = Yoga.Node.create(config);301 root_child1.setWidth(10);302 root.insertChild(root_child1, 1);303 var root_child2 = Yoga.Node.create(config);304 root_child2.setWidth(10);305 root.insertChild(root_child2, 2);306 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);307 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");308 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");309 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");310 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");311 console.assert(90 === root_child0.getComputedLeft(), "90 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");312 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");313 console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");314 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");315 console.assert(80 === root_child1.getComputedLeft(), "80 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");316 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");317 console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");318 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");319 console.assert(70 === root_child2.getComputedLeft(), "70 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");320 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");321 console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");322 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");323 root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);324 console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");325 console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");326 console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");327 console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");328 console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");329 console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");330 console.assert(10 === root_child0.getComputedWidth(), "10 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");331 console.assert(100 === root_child0.getComputedHeight(), "100 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");332 console.assert(10 === root_child1.getComputedLeft(), "10 === root_child1.getComputedLeft() (" + root_child1.getComputedLeft() + ")");333 console.assert(0 === root_child1.getComputedTop(), "0 === root_child1.getComputedTop() (" + root_child1.getComputedTop() + ")");334 console.assert(10 === root_child1.getComputedWidth(), "10 === root_child1.getComputedWidth() (" + root_child1.getComputedWidth() + ")");335 console.assert(100 === root_child1.getComputedHeight(), "100 === root_child1.getComputedHeight() (" + root_child1.getComputedHeight() + ")");336 console.assert(20 === root_child2.getComputedLeft(), "20 === root_child2.getComputedLeft() (" + root_child2.getComputedLeft() + ")");337 console.assert(0 === root_child2.getComputedTop(), "0 === root_child2.getComputedTop() (" + root_child2.getComputedTop() + ")");338 console.assert(10 === root_child2.getComputedWidth(), "10 === root_child2.getComputedWidth() (" + root_child2.getComputedWidth() + ")");339 console.assert(100 === root_child2.getComputedHeight(), "100 === root_child2.getComputedHeight() (" + root_child2.getComputedHeight() + ")");340 } finally {341 if (typeof root !== "undefined") {342 root.freeRecursive();343 }344 config.free();345 }...

Full Screen

Full Screen

rename-organization.js

Source:rename-organization.js Github

copy

Full Screen

1var utils = require('./utils.js');2var Letter = utils.app.db('letter')3var Org = utils.app.db('organization')4var orgController = require('../simaya/controller/organization.js')(utils.app);5var User = utils.app.db('user')6var Deputy = utils.app.db('deputy')7var Template = utils.app.db('template')8var async = require('async')9var organizations = [10 {parent : 'Org1', name : 'Org1-child1'},11 {parent : 'Org1;Org1-child1', name : 'Org1-child2'},12 {parent : 'Org1;Org1-child1;Org1-child2', name : 'Org1-child3'},13 {parent : 'Org1;Org1-child1;Org1-child2', name : 'Org1-child3-ext'},14 {parent : 'Org1', name : 'Org1'}15]16var letters = [17 {18 title : 'letter1',19 senderOrganization : 'Org1',20 receivingOrganizations : {21 'Org1' : { status : 6}22 }23 },24 {25 title : 'letter2',26 senderOrganization : 'Org1;Org1-child1;Org1-child2',27 receivingOrganizations : {28 'Org1' : { status : 6}29 }30 },31 {32 title : 'letter3',33 senderOrganization : 'Org1;Org1-child1;Org1-child2',34 receivingOrganizations : {35 'Org1;Org1-child1;Org1-child2' : { status : 6},36 'Org1;Org1-child1;Org1-child2;Org1-child3' : { status : 6}37 }38 },39 {40 title : 'letter4',41 senderOrganization : 'Org1;Org1-child1;Org1-child2;Org1-child3',42 receivingOrganizations : {43 'Org1;Org1-child1;Org1-child2' : { status : 6},44 'Org1;Org1-child1;Org1-child2;Org1-child3' : { status : 6}45 }46 }47]48var deputies = [49 {50 assignee : "kabid.kominfo.org1", 51 assignor : "kadis.kominfo.org1",52 organization : "Org1;Org1-child1;Org1-child2"53 },54 {55 assignee : "kabid.ayampanggang.org1", 56 assignor : "kadis.ayampanggang.org1",57 organization : "Org1;Org1-child1;Org1-child2"58 },59 {60 assignee : "kabid.ayamgoreng.org1", 61 assignor : "kadis.ayamgoreng.org1",62 organization : "Org1;Org1-child1;Org1-child2;Org1-child3"63 }64]65var users = [66 {67 username : 'user1',68 password : 'password',69 profile : {70 organization : 'Org1;Org1-child1;Org1-child2'71 }72 },73 {74 username : 'user2',75 password : 'password',76 profile : {77 organization : 'Org1;Org1-child1;Org1-child2'78 }79 },80 {81 username : 'user3',82 password : 'password',83 profile : {84 organization : 'Org1;Org1-child1;Org1-child2;Org1-child3'85 }86 },87]88var templates = [89 { creator: 'user1', sharedTo: 'Org1;Org1-child1;Org1-child2'},90 { creator: 'user2', sharedTo: 'Org1;Org1-child1;Org1-child2'}91]92function createOrganization(org, cb){93 Org.save({name : org.name, path: org.parent + (org.name != org.parent ? (";" + org.name) : '') , created_at : new Date()}, function(err){94 if(err) return cb(err)95 cb(null, org.name)96 })97}98function createOrganizations(data, done){99 async.map(data, createOrganization, function(err, results){100 done(err, results)101 })102}103function renameOrganization(oldPath, newPath, done){104 var oldArr = oldPath.split(";")105 var newArr = newPath.split(";")106 var oldName = oldArr[oldArr.length - 1]107 var newName = newArr[newArr.length - 1]108 Org.findOne({ name : oldName}, function(err, res){109 if(err) return done(err)110 if(!res) return done(new Error('Not Found'))111 Org.findArray({$where : "this.path.indexOf('" + oldName + "') > -1"}, function(err, data){112 function repathAndSave(datum, cb){113 var path = datum.path.split(oldName).join(newName)114 var newOrg = datum115 newOrg.path = path116 newOrg.name = (newOrg.name == oldName) ? newName : newOrg.name117 Org.save(newOrg, function(err){118 cb(err, path) 119 })120 }121 async.map(data, repathAndSave, function(err, renames){122 done(err, renames)123 })124 })125 })126}127function createUser(user, cb){128 User.save(user, function(err){129 if(err) return cb(err)130 cb(null, user.username)131 })132}133function createDeputy(deputy, cb){134 Deputy.save(deputy, function(err){135 if(err) return cb(err)136 cb(null, deputy.assignor)137 })138}139function createTemplate(template, cb){140 Template.save(template, function(err){141 if (err) {142 return cb(err);143 }144 cb(null, template.sharedTo)145 })146}147function createUsers(data, done){148 async.map(data, createUser, function(err, results){149 done(err, results)150 })151}152function createDeputies(data, done){153 async.map(data, createDeputy, function(err, results){154 done(err, results)155 })156}157function createTemplates(data, done){158 async.map(data, createTemplate, function(err, results){159 done(err, results)160 })161}162function createLetter(letter, cb){163 Letter.save({164 title : letter.title,165 senderOrganization : letter.senderOrganization,166 receivingOrganizations : letter.receivingOrganizations167 }, function(err){168 if(err) return cb(err)169 cb(null, letter.title)170 })171}172function createLetters(data, done){173 async.map(data, createLetter, function(err, results){174 done(err, results)175 })176}177var from = 'Org1;Org1-child1;Org1-child2'178var to = 'Org1;Org1-child1;Org1-child2-rename'179testCases = {180 setUp: function(callback) {181 utils.db.open(function() {182 if(numberOfTestsRun == numberOfTests) {183 // Drop database in the first run 184 utils.db.dropDatabase(function(err, done) {185 callback(); 186 }); 187 } else {188 callback(); 189 } 190 });191 },192 tearDown : function(callback){193 numberOfTestsRun = numberOfTestsRun - 1;194 utils.db.close();195 callback();196 },197 prepareOrganizations : function(test){198 createOrganizations(organizations, function(err, data){199 test.ok(data.length == organizations.length, "organizations creation failed")200 test.ok(data[1] == 'Org1-child2', "the second org should 'Org1-child2'")201 test.done()202 })203 },204 prepareUsers : function(test){205 createUsers(users, function(err, data){206 test.ok(data.length == users.length, "users creation failed")207 test.done()208 })209 },210 prepareDeputies : function(test){211 createDeputies(deputies, function(err, data){212 test.ok(data.length == deputies.length, "deputies creation failed")213 test.done()214 })215 },216 prepareLetters : function(test){217 createLetters(letters, function(err, data){218 test.ok(data.length == letters.length, "letters creation failed")219 test.done()220 })221 },222 prepareTemplates : function(test){223 createTemplates(templates, function(err, data){224 test.ok(data.length == templates.length, "templates creation failed")225 test.done()226 })227 },228 renameOrganizationThenSyncRelatedCollections : function(test){229 utils.db.dropDatabase(function(err, done) {230 async.series([231 function(callback){232 createOrganizations(organizations, callback)233 },234 function(callback){235 createLetters(letters, callback)236 },237 function(callback){238 createUsers(users, callback)239 },240 function(callback){241 createDeputies(deputies, callback)242 },243 function(callback){244 createTemplates(templates, callback)245 },246 function(callback){247 renameOrganization( from, to, callback)248 },249 function(callback){250 orgController.syncRelatedCollections(from, to, callback)251 }252 ], function(err, last){253 var t = last[last.length - 1]254 function flatten(a, r){255 if(!r){ r = []}256 for(var i=0; i<a.length; i++){257 if(a[i].constructor == Array || typeof a[i] == 'object'){258 flatten(a[i], r);259 }else{260 r.push(a[i]);261 }262 }263 return r;264 }265 test.ok(flatten(t).indexOf(false) == -1)266 async.series([267 // rename Org1-child3268 function(callback){269 Org.findOne({ name : 'Org1-child3'}, function(err, o){270 test.ok(o.path == 'Org1;Org1-child1;Org1-child2-rename;Org1-child3', 'Renaming Org1-child3 failed')271 callback(err, o)272 })273 },274 // letter2 has Org1-child2 in senderOrganization, the full-path has to be renamed to Org1;Org1-child1;Org1-child2-rename275 function(callback){276 Letter.findOne({ title : 'letter2'}, function(err, l){277 test.ok(l.senderOrganization == 'Org1;Org1-child1;Org1-child2-rename', 'Renaming org letter2 failed')278 callback(err, l)279 })280 },281 // letter3 has Org1-child2 in senderOrganization, the full-path has to be renamed to Org1;Org1-child1;Org1-child2-rename282 // letter3 has Org1-child2 in receivingOrganizations, the full-path should contains Org1-child2-rename283 function(callback){284 Letter.findOne({ title : 'letter3'}, function(err, l){285 test.ok(l.senderOrganization == 'Org1;Org1-child1;Org1-child2-rename', 'Renaming org letter3 failed')286 for(var k in l.receivingOrganizations){287 test.ok(k.indexOf('Org1-child2-rename') > -1, 'Renaming org letter failed')288 }289 callback(err, l)290 })291 },292 function(callback){293 // user1's org is Org1;Org1-child1;Org1-child2 it has to be renamed to Org1;Org1-child1;Org1-child2294 User.findOne({ username : 'user1'}, function(err, u){295 test.ok(u.profile.organization == 'Org1;Org1-child1;Org1-child2-rename', 'Renaming org user1 failed')296 callback(err, u)297 })298 },299 // user3's org is Org1;Org1-child1;Org1-child2;Org1-child3 it has to be renamed to Org1;Org1-child1;Org1-child2-rename;Org1-child3300 function(callback){301 User.findOne({ username : 'user3'}, function(err, u){302 test.ok(u.profile.organization == "Org1;Org1-child1;Org1-child2-rename;Org1-child3", 'Renaming org user3 failed')303 callback(err, u)304 })305 },306 function(callback){307 // deputy.assignee kabid.kominfo.org1 has Org1;Org1-child1;Org1-child2, it should be renamed to Org1;Org1-child1;Org1-child2-rename308 Deputy.findOne({ assignee : 'kabid.kominfo.org1'}, function(err, u){309 test.ok(u.organization == 'Org1;Org1-child1;Org1-child2-rename', 'Renaming org deputy kabid.kominfo.org1 failed')310 callback(err, u)311 })312 },313 // deputy.assignee kabid.ayamgoreng.org1 has Org1;Org1-child1;Org1-child2;Org1-child3, it should be renamed to Org1;Org1-child1;Org1-child2-rename;Org1-child3314 function(callback){315 Deputy.findOne({ assignee : 'kabid.ayamgoreng.org1'}, function(err, u){316 test.ok(u.organization == 'Org1;Org1-child1;Org1-child2-rename;Org1-child3', 'Renaming org deputy kabid.ayamgoreng.org1 failed')317 callback(err, u)318 })319 },320 // template created by user1 previously sharedTo Org1;Org1-child1;Org1-child2, it should changed to Org1;Org1-child1;Org1-child2-rename321 function(callback){322 Template.findOne({ creator: 'user1'}, function(err, t){323 test.ok(t.sharedTo == 'Org1;Org1-child1;Org1-child2-rename', 'Renaming org template created by user1 failed')324 callback(err, t)325 })326 }327 ], function(err, results){328 test.done()329 })330 })331 })332 } 333}334var numberOfTests = Object.keys(testCases).length;335var numberOfTestsRun = numberOfTests; ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';2import { Child2Component } from './child2.component';3import { ParentComponent } from './parent.component';4describe('ParentComponent', () => {5 beforeEach(() => MockBuilder(ParentComponent).mock(Child2Component));6 it('should create', () => {7 const fixture = MockRender(ParentComponent);8 expect(ngMocks.find(Child2Component)).toBeDefined();9 });10});11import { Component, Input } from '@angular/core';12import { Child1Component } from './child1.component';13@Component({14})15export class Child2Component {16 @Input() text: string;17 constructor() {}18}19import { Component, Input } from '@angular/core';20@Component({21 <p>{{ text }}</p>22})23export class Child1Component {24 @Input() text: string;25 constructor() {}26}27import { Component } from '@angular/core';28@Component({29})30export class ParentComponent {31 text = 'parent';32 constructor() {}33}34import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';35import { Child2Component } from './child2.component';36import { ParentComponent } from './parent.component';37describe('Child2Component', () => {38 beforeEach(() => MockBuilder(Child2Component).mock(Child2Component));39 it('should create', () => {40 const fixture = MockRender(Child2Component);41 expect(ngMocks.find(Child2Component)).toBeDefined();42 });43});44import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';45import { Child1Component } from './child1.component';46import { ParentComponent } from './parent.component';47describe('Child1Component', () => {48 beforeEach(() => MockBuilder(Child1Component).mock(Child1Component));49 it('should create', () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';2import { AppModule } from './app.module';3import { AppComponent } from './app.component';4MockBuilder(AppComponent, AppModule);5const fixture = MockRender(AppComponent);6const component = ngMocks.findInstance(AppComponent);7component.child2.method();8ngMocks.stub(component.child2, 'method', () => 'mocked');9component.child2.method();10ngMocks.stub(component.child2, 'method', () => 'mocked');

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Child2 } from './child2';2import { Child1 } from './child1';3import { Parent } from './parent';4const child2 = new Child2();5child2.method1();6const child1 = new Child1();7child1.method1();8const parent = new Parent();9parent.method1();10import { Child2 } from './child2';11import { Child1 } from './child1';12import { Parent } from './parent';13const child2 = new Child2();14child2.method1();15const child1 = new Child1();16child1.method1();17const parent = new Parent();18parent.method1();19import { Child2 } from './child2';20import { Child1 } from './child1';21import { Parent } from './parent';22const child2 = new Child2();23child2.method1();24const child1 = new Child1();25child1.method1();26const parent = new Parent();27parent.method1();28import { Child2 } from './child2';29import { Child1 } from './child1';30import { Parent } from './parent';31const child2 = new Child2();32child2.method1();33const child1 = new Child1();34child1.method1();35const parent = new Parent();36parent.method1();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { MockBuilder, MockRender } = ngMocks;2MockBuilder().mock(Child2Component);3const fixture = MockRender(`4`);5const child1 = ngMocks.findInstance(Child1Component);6expect(child1).toBeDefined();7const child2 = ngMocks.findInstance(Child2Component);8expect(child2).toBeDefined();9@Component({10})11export class Child1Component {12 constructor() {}13}14@Component({15})16export class Child2Component {17 constructor() {}18}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { child2 } from 'ng-mocks';2import { child2 } from 'ng-mocks';3child2(fixture, ChildComponent).method();4import { child2 } from 'ng-mocks';5import { child2 } from 'ng-mocks';6child2(fixture, ChildComponent).method();7child2(fixture, ChildCompo

Full Screen

Using AI Code Generation

copy

Full Screen

1var child = ngMocks.findInstance(child2);2var child = ngMocks.findInstance(child2, { strict: true });3var child = ngMocks.findInstance(child2, { strict: false });4var child = ngMocks.findInstance(child2);5var child = ngMocks.findInstance(child2, { strict: true });6var child = ngMocks.findInstance(child2, { strict: false });7var child = ngMocks.findInstance(child2);8var child = ngMocks.findInstance(child2, { strict: true });9var child = ngMocks.findInstance(child2, { strict: false });10var child = ngMocks.findInstance(child2);11var child = ngMocks.findInstance(child2, { strict: true });12var child = ngMocks.findInstance(child2, { strict: false });13var child = ngMocks.findInstance(child2);14var child = ngMocks.findInstance(child2, { strict: true });15var child = ngMocks.findInstance(child2, { strict: false });16var child = ngMocks.findInstance(child2);17var child = ngMocks.findInstance(child2, { strict: true });18var child = ngMocks.findInstance(child2, { strict: false });19var child = ngMocks.findInstance(child2);20var child = ngMocks.findInstance(child2, { strict: true });21var child = ngMocks.findInstance(child2, { strict: false });22var child = ngMocks.findInstance(child2);23var child = ngMocks.findInstance(child2, { strict: true });24var child = ngMocks.findInstance(child2, { strict: false });25var child = ngMocks.findInstance(child2);26var child = ngMocks.findInstance(child2, { strict: true });27var child = ngMocks.findInstance(child2, { strict: false });

Full Screen

Using AI Code Generation

copy

Full Screen

1beforeEach(() => {2 TestBed.configureTestingModule({3 imports: [Child2Module]4 });5});6imports: [7 NgMocks.guts(Child2Module, {8 imports: [Child1Module]9 })10imports: [11 NgMocks.guts(Child2Module, {12 imports: [Child1Module],13 {14 useValue: NgMocks.stub(Child1Service),15 },16 })17imports: [18 NgMocks.guts(Child2Module, {19 imports: [Child1Module],20 {21 useValue: NgMocks.stub(Child1Service),22 },23 {24 useValue: NgMocks.stub(Child2Service),25 },26 })27beforeEach(() => {28 TestBed.configureTestingModule({29 imports: [Child2Module],30 });31 fixture = TestBed.createComponent(Child2Component);32 component = fixture.componentInstance;33 fixture.detectChanges();34});35beforeEach(() => {36 TestBed.configureTestingModule({37 imports: [Child2Module],38 });39 fixture = TestBed.createComponent(Child2Component);40 component = fixture.componentInstance;41 fixture.detectChanges();42 NgMocks.render(Child2Component);43});44beforeEach(() => {45 TestBed.configureTestingModule({46 imports: [Child2Module],47 });48 fixture = TestBed.createComponent(Child2Component);49 component = fixture.componentInstance;50 fixture.detectChanges();51 NgMocks.render(Child2Component, {52 {53 useValue: NgMocks.stub(Child1Service),54 },55 {

Full Screen

Using AI Code Generation

copy

Full Screen

1var child2 = require('ng-mocks').child2;2var component = child2('myComponent');3expect(component.myMethod()).toEqual('myMethod');4var child2 = require('ng-mocks').child2;5var component = child2('myComponent');6expect(component.myMethod()).toEqual('myMethod');

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ng-mocks automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful