Best JavaScript code snippet using storybook-root
regress-302439.js
Source:regress-302439.js  
...42var expect = 'No Crash';43printBugNumber(BUGNUMBER);44printStatus (summary);45function productList(catID,famID) {46  clearBox(document.Support_Form.Product_ID);47  switch(parseInt(catID)) {48  case 1 :                             // Sound Blaster49    switch(parseInt(famID)) {50    case 434 :                     // Audigy 451      break;52    case 204 :                     // Audigy 253      break;54    case 205 :                     // Audigy55      try { addBoxItem(document.Support_Form.Product_ID, 'Audigy Platinum eX', '45'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2');  } //56      try { addBoxItem(document.Support_Form.Product_ID, 'Audigy Platinum', '4846'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2');  } //57      try { addBoxItem(document.Support_Form.Product_ID, 'Audigy LS (SE)', '10365'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2');  } //58      try { addBoxItem(document.Support_Form.Product_ID, 'Audigy Digital Entertainment', '5085'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2');  } //59      try { addBoxItem(document.Support_Form.Product_ID, 'Audigy ES', '5086'); } catch(e) {addBoxItem(document.Support_Form.Product_ID, '1', '2');  } //60      break;...extension.js
Source:extension.js  
...36        // orders.37        this._boxOrderCreator = new BoxOrderCreator.BoxOrderCreator(this._appIndicatorKStatusNotifierItemManager);38        this._addNewItemsToBoxOrders();39        this._orderTopBarItemsOfAllBoxes();40        this._overwritePanelAddToPanelBox();41        // Handle changes of configured box orders.42        this._settingsHandlerIds = [ ];43        const addConfiguredBoxOrderChangeHandler = (box) => {44            let handlerId = this.settings.connect(`changed::${box}-box-order`, () => {45                this._orderTopBarItems(box);46                /// For the case, where the currently saved box order is based47                /// on a permutation of an outdated box order, get an updated48                /// box order and save it, if needed.49                let updatedBoxOrder;50                switch (box) {51                    case "left":52                        updatedBoxOrder = this._createUpdatedBoxOrders().left;53                        break;54                    case "center":55                        updatedBoxOrder = this._createUpdatedBoxOrders().center;56                        break;57                    case "right":58                        updatedBoxOrder = this._createUpdatedBoxOrders().right;59                        break;60                }61                // Only save the updated box order to settings, if it is62                // different, to avoid looping.63                const currentBoxOrder = this.settings.get_strv(`${box}-box-order`);64                if (JSON.stringify(currentBoxOrder) !== JSON.stringify(updatedBoxOrder)) {65                    this.settings.set_strv(`${box}-box-order`, updatedBoxOrder);66                }67            });68            this._settingsHandlerIds.push(handlerId);69        };70        addConfiguredBoxOrderChangeHandler("left");71        addConfiguredBoxOrderChangeHandler("center");72        addConfiguredBoxOrderChangeHandler("right");73    }74    disable() {75        // Revert the overwrite of `Panel._addToPanelBox`.76        Panel.Panel.prototype._addToPanelBox = Panel.Panel.prototype._originalAddToPanelBox;77        // Set `Panel._originalAddToPanelBox` to `undefined`.78        Panel._originalAddToPanelBox = undefined;79        // Disconnect signals.80        for (const handlerId of this._settingsHandlerIds) {81            this.settings.disconnect(handlerId);82        }83    }84    ////////////////////////////////////////////////////////////////////////////85    /// Methods used on extension enable.                                    ///86    ////////////////////////////////////////////////////////////////////////////87    /**88     * This method adds all new items currently present in the Gnome Shell top89     * bar to the box orders.90     */91    _addNewItemsToBoxOrders() {92        const boxOrders = this._createUpdatedBoxOrders();93        this.settings.set_strv("left-box-order", boxOrders.left);94        this.settings.set_strv("center-box-order", boxOrders.center);95        this.settings.set_strv("right-box-order", boxOrders.right);96    }97    /**98     * This methods orders the top bar items of all boxes according to the99     * configured box orders using `this._orderTopBarItems`.100     */101    _orderTopBarItemsOfAllBoxes() {102        this._orderTopBarItems("left");103        this._orderTopBarItems("center");104        this._orderTopBarItems("right");105    }106    /**107     * An object containing a position and box overwrite.108     * @typedef PositionAndBoxOverwrite109     * @property {Number} position - The position overwrite.110     * @property {string} box - The position box overwrite.111     */112    /**113     * Overwrite `Panel._addToPanelBox` with a custom method, which handles top114     * bar item additions to make sure that they are added in the correct115     * position and box.116     */117    _overwritePanelAddToPanelBox() {118        // Add the original `Panel._addToPanelBox` method as119        // `Panel._originalAddToPanelBox`.120        Panel.Panel.prototype._originalAddToPanelBox = Panel.Panel.prototype._addToPanelBox;121        // This function gets used by the `Panel._addToPanelBox` overwrite to122        // determine the position and box for a new item.123        // It also adds the new item to the relevant box order, if it isn't in124        // it already.125        const getPositionAndBoxOverwrite = (role, box, indicator) => {126            const boxOrders = {127                left: this.settings.get_strv("left-box-order"),128                center: this.settings.get_strv("center-box-order"),129                right: this.settings.get_strv("right-box-order"),130            };131            let boxOrder;132            // Handle the case where the new item is a133            // AppIndicator/KStatusNotifierItem.134            if (role.startsWith("appindicator-")) {135                switch (box) {136                    case "left":137                        boxOrder = this.settings.get_strv("left-box-order");138                        this._appIndicatorKStatusNotifierItemManager.handleAppIndicatorKStatusNotifierItemItem(indicator.container, role, boxOrder, boxOrders);139                        this.settings.set_strv("left-box-order", boxOrder);140                        break;141                    case "center":142                        boxOrder = this.settings.get_strv("center-box-order");143                        this._appIndicatorKStatusNotifierItemManager.handleAppIndicatorKStatusNotifierItemItem(indicator.container, role, boxOrder, boxOrders);144                        this.settings.set_strv("center-box-order", boxOrder);145                        break;146                    case "right":147                        boxOrder = this.settings.get_strv("right-box-order");148                        this._appIndicatorKStatusNotifierItemManager.handleAppIndicatorKStatusNotifierItemItem(indicator.container, role, boxOrder, boxOrders, true);149                        this.settings.set_strv("right-box-order", boxOrder);150                        break;151                }152            }153            // Get the resolved box orders for all boxes.154            const resolvedBoxOrders = {155                left: this._appIndicatorKStatusNotifierItemManager.createResolvedBoxOrder(this.settings.get_strv("left-box-order")),156                center: this._appIndicatorKStatusNotifierItemManager.createResolvedBoxOrder(this.settings.get_strv("center-box-order")),157                right: this._appIndicatorKStatusNotifierItemManager.createResolvedBoxOrder(this.settings.get_strv("right-box-order")),158            };159            // Also get the restricted valid box order of the target box.160            const restrictedValidBoxOrderOfTargetBox = this._boxOrderCreator.createRestrictedValidBoxOrder(box);161            // Get the index of the role for each box order.162            const indices = {163                left: resolvedBoxOrders.left.indexOf(role),164                center: resolvedBoxOrders.center.indexOf(role),165                right: resolvedBoxOrders.right.indexOf(role),166            };167            // If the role is not already configured in one of the box orders,168            // just add it to the target box order at the end/beginning, save169            // the updated box order and return the relevant position and box.170            if (indices.left === -1171                && indices.center === -1172                && indices.right === -1) {173                switch (box) {174                    // For the left and center box, insert the role at the end,175                    // since they're LTR.176                    case "left":177                        boxOrders["left"].push(role);178                        this.settings.set_strv("left-box-order", boxOrders["left"]);179                        return {180                            position: restrictedValidBoxOrderOfTargetBox.length - 1,181                            box: box182                        };183                    case "center":184                        boxOrders["center"].push(role);185                        this.settings.set_strv("center-box-order", boxOrders["center"]);186                        return {187                            position: restrictedValidBoxOrderOfTargetBox.length - 1,188                            box: box189                        };190                    // For the right box, insert the role at the beginning,191                    // since it's RTL.192                    case "right":193                        boxOrders["right"].unshift(role);194                        this.settings.set_strv("right-box-order", boxOrders["right"]);195                        return {196                            position: 0,197                            box: box198                        };199                }200            }201            /// Since the role is already configured in one of the box orders,202            /// determine the correct insertion index for the position.203            const determineInsertionIndex = (index, restrictedValidBoxOrder, boxOrder) => {204                // Set the insertion index initially to 0, so that if no closest205                // item can be found, the new item just gets inserted at the206                // beginning.207                let insertionIndex = 0;208                // Find the index of the closest item, which is also in the209                // valid box order and before the new item.210                // This way, we can insert the new item just after the index of211                // this closest item.212                for (let i = index - 1; i >= 0; i--) {213                    let potentialClosestItemIndex = restrictedValidBoxOrder.indexOf(boxOrder[i]);214                    if (potentialClosestItemIndex !== -1) {215                        insertionIndex = potentialClosestItemIndex + 1;216                        break;217                    }218                }219                return insertionIndex;220            };221            if (indices.left !== -1) {222                return {223                    position: determineInsertionIndex(indices.left, this._boxOrderCreator.createRestrictedValidBoxOrder("left"), resolvedBoxOrders.left),224                    box: "left"225                };226            }227            if (indices.center !== -1) {228                return {229                    position: determineInsertionIndex(indices.center, this._boxOrderCreator.createRestrictedValidBoxOrder("center"), resolvedBoxOrders.center),230                    box: "center"231                };232            }233            if (indices.right !== -1) {234                return {235                    position: determineInsertionIndex(indices.right, this._boxOrderCreator.createRestrictedValidBoxOrder("right"), resolvedBoxOrders.right),236                    box: "right"237                };238            }239        };240        // Overwrite `Panel._addToPanelBox`.241        Panel.Panel.prototype._addToPanelBox = function (role, indicator, position, box) {242            // Get the position and box overwrite.243            let positionBoxOverwrite;244            switch (box) {245                case this._leftBox:246                    positionBoxOverwrite = getPositionAndBoxOverwrite(role, "left", indicator);247                    break;248                case this._centerBox:249                    positionBoxOverwrite = getPositionAndBoxOverwrite(role, "center", indicator);250                    break;251                case this._rightBox:252                    positionBoxOverwrite = getPositionAndBoxOverwrite(role, "right", indicator);253                    break;254            }255            // Call the original `Panel._addToPanelBox` with the position256            // overwrite as the position argument and the box determined by the257            // box overwrite as the box argument.258            switch (positionBoxOverwrite.box) {259                case "left":260                    this._originalAddToPanelBox(role, indicator, positionBoxOverwrite.position, Main.panel._leftBox);261                    break;262                case "center":263                    this._originalAddToPanelBox(role, indicator, positionBoxOverwrite.position, Main.panel._centerBox);264                    break;265                case "right":266                    this._originalAddToPanelBox(role, indicator, positionBoxOverwrite.position, Main.panel._rightBox);267                    break;268            }269        };270    }271    ////////////////////////////////////////////////////////////////////////////272    /// Helper methods holding logic needed by other methods.                ///273    ////////////////////////////////////////////////////////////////////////////274    /**275     * An object containing a box order for the left, center and right top bar276     * box.277     * @typedef {Object} BoxOrders278     * @property {string[]} left - The box order for the left top bar box.279     * @property {string[]} center - The box order for the center top bar box.280     * @property {string[]} right - The box order for the right top bar box....box_test.js
Source:box_test.js  
...16goog.require('goog.math.Box');17goog.require('goog.math.Coordinate');18goog.require('goog.testing.jsunit');19function testBoxEquals() {20  var a = new goog.math.Box(1, 2, 3, 4);21  var b = new goog.math.Box(1, 2, 3, 4);22  assertTrue(goog.math.Box.equals(a, a));23  assertTrue(goog.math.Box.equals(a, b));24  assertTrue(goog.math.Box.equals(b, a));25  assertFalse('Box should not equal null.', goog.math.Box.equals(a, null));26  assertFalse('Box should not equal null.', goog.math.Box.equals(null, a));27  assertFalse(goog.math.Box.equals(a, new goog.math.Box(4, 2, 3, 4)));28  assertFalse(goog.math.Box.equals(a, new goog.math.Box(1, 4, 3, 4)));29  assertFalse(goog.math.Box.equals(a, new goog.math.Box(1, 2, 4, 4)));30  assertFalse(goog.math.Box.equals(a, new goog.math.Box(1, 2, 3, 1)));31  assertTrue('Null boxes should be equal.', goog.math.Box.equals(null, null));32}33function testBoxClone() {34  var b = new goog.math.Box(0, 0, 0, 0);35  assertTrue(goog.math.Box.equals(b, b.clone()));36  b.left = 0;37  b.top = 1;38  b.right = 2;39  b.bottom = 3;40  assertTrue(goog.math.Box.equals(b, b.clone()));41}42function testBoxRelativePositionX() {43  var box = new goog.math.Box(50, 100, 100, 50);44  assertEquals(0,45      goog.math.Box.relativePositionX(box, new goog.math.Coordinate(75, 0)));46  assertEquals(0,47      goog.math.Box.relativePositionX(box, new goog.math.Coordinate(75, 75)));48  assertEquals(0,49      goog.math.Box.relativePositionX(box, new goog.math.Coordinate(75, 105)));50  assertEquals(-5,51      goog.math.Box.relativePositionX(box, new goog.math.Coordinate(45, 75)));52  assertEquals(5,53      goog.math.Box.relativePositionX(box, new goog.math.Coordinate(105, 75)));54}55function testBoxRelativePositionY() {56  var box = new goog.math.Box(50, 100, 100, 50);57  assertEquals(0,58      goog.math.Box.relativePositionY(box, new goog.math.Coordinate(0, 75)));59  assertEquals(0,60      goog.math.Box.relativePositionY(box, new goog.math.Coordinate(75, 75)));61  assertEquals(0,62      goog.math.Box.relativePositionY(box, new goog.math.Coordinate(105, 75)));63  assertEquals(-5,64      goog.math.Box.relativePositionY(box, new goog.math.Coordinate(75, 45)));65  assertEquals(5,66      goog.math.Box.relativePositionY(box, new goog.math.Coordinate(75, 105)));67}68function testBoxDistance() {69  var box = new goog.math.Box(50, 100, 100, 50);70  assertEquals(0,71               goog.math.Box.distance(box, new goog.math.Coordinate(75, 75)));72  assertEquals(25,73               goog.math.Box.distance(box, new goog.math.Coordinate(75, 25)));74  assertEquals(10,75               goog.math.Box.distance(box, new goog.math.Coordinate(40, 80)));76  assertEquals(5,77               goog.math.Box.distance(box, new goog.math.Coordinate(46, 47)));78  assertEquals(10,79               goog.math.Box.distance(box, new goog.math.Coordinate(106, 108)));80}81function testBoxContains() {82  var box = new goog.math.Box(50, 100, 100, 50);83  assertTrue(goog.math.Box.contains(box, new goog.math.Coordinate(75, 75)));84  assertTrue(goog.math.Box.contains(box, new goog.math.Coordinate(50, 100)));85  assertTrue(goog.math.Box.contains(box, new goog.math.Coordinate(100, 99)));86  assertFalse(goog.math.Box.contains(box, new goog.math.Coordinate(100, 101)));87  assertFalse(goog.math.Box.contains(box, new goog.math.Coordinate(49, 50)));88  assertFalse(goog.math.Box.contains(box, new goog.math.Coordinate(25, 25)));89}90function testBoxContainsBox() {91  var box = new goog.math.Box(50, 100, 100, 50);92  function assertContains(boxB) {93    assertTrue(box + ' expected to contain ' + boxB,94        goog.math.Box.contains(box, boxB));95  }96  function assertNotContains(boxB) {97    assertFalse(box + ' expected to not contain ' + boxB,98        goog.math.Box.contains(box, boxB));99  }100  assertContains(new goog.math.Box(60, 90, 90, 60));101  assertNotContains(new goog.math.Box(1, 3, 4, 2));102  assertNotContains(new goog.math.Box(30, 90, 60, 60));103  assertNotContains(new goog.math.Box(60, 110, 60, 60));104  assertNotContains(new goog.math.Box(60, 90, 110, 60));105  assertNotContains(new goog.math.Box(60, 90, 60, 40));106}107function testBoxesIntersect() {108  var box = new goog.math.Box(50, 100, 100, 50);109  function assertIntersects(boxB) {110    assertTrue(box + ' expected to intersect ' + boxB,111        goog.math.Box.intersects(box, boxB));112  }113  function assertNotIntersects(boxB) {114    assertFalse(box + ' expected to not intersect ' + boxB,115        goog.math.Box.intersects(box, boxB));116  }117  assertIntersects(box);118  assertIntersects(new goog.math.Box(20, 80, 80, 20));119  assertIntersects(new goog.math.Box(50, 80, 100, 20));120  assertIntersects(new goog.math.Box(80, 80, 120, 20));121  assertIntersects(new goog.math.Box(20, 100, 80, 50));122  assertIntersects(new goog.math.Box(80, 100, 120, 50));123  assertIntersects(new goog.math.Box(20, 120, 80, 80));124  assertIntersects(new goog.math.Box(50, 120, 100, 80));125  assertIntersects(new goog.math.Box(80, 120, 120, 80));126  assertIntersects(new goog.math.Box(20, 120, 120, 20));127  assertIntersects(new goog.math.Box(70, 80, 80, 70));128  assertNotIntersects(new goog.math.Box(10, 30, 30, 10));129  assertNotIntersects(new goog.math.Box(10, 70, 30, 30));130  assertNotIntersects(new goog.math.Box(10, 100, 30, 50));131  assertNotIntersects(new goog.math.Box(10, 120, 30, 80));132  assertNotIntersects(new goog.math.Box(10, 140, 30, 120));133  assertNotIntersects(new goog.math.Box(30, 30, 70, 10));134  assertNotIntersects(new goog.math.Box(30, 140, 70, 120));135  assertNotIntersects(new goog.math.Box(50, 30, 100, 10));136  assertNotIntersects(new goog.math.Box(50, 140, 100, 120));137  assertNotIntersects(new goog.math.Box(80, 30, 120, 10));138  assertNotIntersects(new goog.math.Box(80, 140, 120, 120));139  assertNotIntersects(new goog.math.Box(120, 30, 140, 10));140  assertNotIntersects(new goog.math.Box(120, 70, 140, 30));141  assertNotIntersects(new goog.math.Box(120, 100, 140, 50));142  assertNotIntersects(new goog.math.Box(120, 120, 140, 80));143  assertNotIntersects(new goog.math.Box(120, 140, 140, 120));144}145function testBoxesIntersectWithPadding() {146  var box = new goog.math.Box(50, 100, 100, 50);147  function assertIntersects(boxB, padding) {148    assertTrue(box + ' expected to intersect ' + boxB + ' with padding ' +149        padding, goog.math.Box.intersectsWithPadding(box, boxB, padding));150  }151  function assertNotIntersects(boxB, padding) {152    assertFalse(box + ' expected to not intersect ' + boxB + ' with padding ' +153        padding, goog.math.Box.intersectsWithPadding(box, boxB, padding));154  }155  assertIntersects(box, 10);156  assertIntersects(new goog.math.Box(20, 80, 80, 20), 10);157  assertIntersects(new goog.math.Box(50, 80, 100, 20), 10);158  assertIntersects(new goog.math.Box(80, 80, 120, 20), 10);159  assertIntersects(new goog.math.Box(20, 100, 80, 50), 10);160  assertIntersects(new goog.math.Box(80, 100, 120, 50), 10);161  assertIntersects(new goog.math.Box(20, 120, 80, 80), 10);162  assertIntersects(new goog.math.Box(50, 120, 100, 80), 10);163  assertIntersects(new goog.math.Box(80, 120, 120, 80), 10);164  assertIntersects(new goog.math.Box(20, 120, 120, 20), 10);165  assertIntersects(new goog.math.Box(70, 80, 80, 70), 10);166  assertIntersects(new goog.math.Box(10, 30, 30, 10), 20);167  assertIntersects(new goog.math.Box(10, 70, 30, 30), 20);168  assertIntersects(new goog.math.Box(10, 100, 30, 50), 20);169  assertIntersects(new goog.math.Box(10, 120, 30, 80), 20);170  assertIntersects(new goog.math.Box(10, 140, 30, 120), 20);171  assertIntersects(new goog.math.Box(30, 30, 70, 10), 20);172  assertIntersects(new goog.math.Box(30, 140, 70, 120), 20);173  assertIntersects(new goog.math.Box(50, 30, 100, 10), 20);174  assertIntersects(new goog.math.Box(50, 140, 100, 120), 20);175  assertIntersects(new goog.math.Box(80, 30, 120, 10), 20);176  assertIntersects(new goog.math.Box(80, 140, 120, 120), 20);177  assertIntersects(new goog.math.Box(120, 30, 140, 10), 20);178  assertIntersects(new goog.math.Box(120, 70, 140, 30), 20);179  assertIntersects(new goog.math.Box(120, 100, 140, 50), 20);180  assertIntersects(new goog.math.Box(120, 120, 140, 80), 20);181  assertIntersects(new goog.math.Box(120, 140, 140, 120), 20);182  assertNotIntersects(new goog.math.Box(10, 30, 30, 10), 10);183  assertNotIntersects(new goog.math.Box(10, 70, 30, 30), 10);184  assertNotIntersects(new goog.math.Box(10, 100, 30, 50), 10);185  assertNotIntersects(new goog.math.Box(10, 120, 30, 80), 10);186  assertNotIntersects(new goog.math.Box(10, 140, 30, 120), 10);187  assertNotIntersects(new goog.math.Box(30, 30, 70, 10), 10);188  assertNotIntersects(new goog.math.Box(30, 140, 70, 120), 10);189  assertNotIntersects(new goog.math.Box(50, 30, 100, 10), 10);190  assertNotIntersects(new goog.math.Box(50, 140, 100, 120), 10);191  assertNotIntersects(new goog.math.Box(80, 30, 120, 10), 10);192  assertNotIntersects(new goog.math.Box(80, 140, 120, 120), 10);193  assertNotIntersects(new goog.math.Box(120, 30, 140, 10), 10);194  assertNotIntersects(new goog.math.Box(120, 70, 140, 30), 10);195  assertNotIntersects(new goog.math.Box(120, 100, 140, 50), 10);196  assertNotIntersects(new goog.math.Box(120, 120, 140, 80), 10);197  assertNotIntersects(new goog.math.Box(120, 140, 140, 120), 10);198}199function testExpandToInclude() {200  var box = new goog.math.Box(10, 50, 50, 10);201  box.expandToInclude(new goog.math.Box(60, 70, 70, 60));202  assertEquals(10, box.left);203  assertEquals(10, box.top);204  assertEquals(70, box.right);205  assertEquals(70, box.bottom);206  box.expandToInclude(new goog.math.Box(30, 40, 40, 30));207  assertEquals(10, box.left);208  assertEquals(10, box.top);209  assertEquals(70, box.right);210  assertEquals(70, box.bottom);211  box.expandToInclude(new goog.math.Box(0, 100, 100, 0));212  assertEquals(0, box.left);213  assertEquals(0, box.top);214  assertEquals(100, box.right);215  assertEquals(100, box.bottom);216}217function testGetWidth() {218  var box = new goog.math.Box(10, 50, 30, 25);219  assertEquals(25, box.getWidth());220}221function testGetHeight() {222  var box = new goog.math.Box(10, 50, 30, 25);223  assertEquals(20, box.getHeight());224}225function testBoundingBox() {226  assertObjectEquals(227      new goog.math.Box(1, 10, 11, 0),228      goog.math.Box.boundingBox(229          new goog.math.Coordinate(5, 5),230          new goog.math.Coordinate(5, 11),231          new goog.math.Coordinate(0, 5),232          new goog.math.Coordinate(5, 1),233          new goog.math.Coordinate(10, 5)));234}235function testBoxCeil() {236  var box = new goog.math.Box(11.4, 26.6, 17.8, 9.2);237  assertEquals('The function should return the target instance',238      box, box.ceil());239  assertObjectEquals(new goog.math.Box(12, 27, 18, 10), box);240}241function testBoxFloor() {242  var box = new goog.math.Box(11.4, 26.6, 17.8, 9.2);243  assertEquals('The function should return the target instance',244      box, box.floor());245  assertObjectEquals(new goog.math.Box(11, 26, 17, 9), box);246}247function testBoxRound() {248  var box = new goog.math.Box(11.4, 26.6, 17.8, 9.2);249  assertEquals('The function should return the target instance',250      box, box.round());251  assertObjectEquals(new goog.math.Box(11, 27, 18, 9), box);252}253function testBoxTranslateCoordinate() {254  var box = new goog.math.Box(10, 30, 20, 5);255  var c = new goog.math.Coordinate(10, 5);256  assertEquals('The function should return the target instance',257      box, box.translate(c));258  assertObjectEquals(new goog.math.Box(15, 40, 25, 15), box);259}260function testBoxTranslateXY() {261  var box = new goog.math.Box(10, 30, 20, 5);262  assertEquals('The function should return the target instance',263      box, box.translate(5, 2));264  assertObjectEquals(new goog.math.Box(12, 35, 22, 10), box);265}266function testBoxTranslateX() {267  var box = new goog.math.Box(10, 30, 20, 5);268  assertEquals('The function should return the target instance',269      box, box.translate(3));270  assertObjectEquals(new goog.math.Box(10, 33, 20, 8), box);271}272function testBoxScaleXY() {273  var box = new goog.math.Box(10, 20, 30, 5);274  assertEquals('The function should return the target instance',275      box, box.scale(2, 3));276  assertObjectEquals(new goog.math.Box(30, 40, 90, 10), box);277}278function testBoxScaleFactor() {279  var box = new goog.math.Box(10, 20, 30, 5);280  assertEquals('The function should return the target instance',281      box, box.scale(2));282  assertObjectEquals(new goog.math.Box(20, 40, 60, 10), box);...box.js
Source:box.js  
...57 *     the box.58 * @return {!goog.math.Box} A Box containing all the specified Coordinates.59 */60goog.math.Box.boundingBox = function(var_args) {61  var box = new goog.math.Box(arguments[0].y, arguments[0].x,62                              arguments[0].y, arguments[0].x);63  for (var i = 1; i < arguments.length; i++) {64    var coord = arguments[i];65    box.top = Math.min(box.top, coord.y);66    box.right = Math.max(box.right, coord.x);67    box.bottom = Math.max(box.bottom, coord.y);68    box.left = Math.min(box.left, coord.x);69  }70  return box;71};72/**73 * @return {number} width The width of this Box.74 */75goog.math.Box.prototype.getWidth = function() {76  return this.right - this.left;77};78/**79 * @return {number} height The height of this Box.80 */81goog.math.Box.prototype.getHeight = function() {82  return this.bottom - this.top;83};84/**85 * Creates a copy of the box with the same dimensions.86 * @return {!goog.math.Box} A clone of this Box.87 */88goog.math.Box.prototype.clone = function() {89  return new goog.math.Box(this.top, this.right, this.bottom, this.left);90};91if (goog.DEBUG) {92  /**93   * Returns a nice string representing the box.94   * @return {string} In the form (50t, 73r, 24b, 13l).95   * @override96   */97  goog.math.Box.prototype.toString = function() {98    return '(' + this.top + 't, ' + this.right + 'r, ' + this.bottom + 'b, ' +99           this.left + 'l)';100  };101}102/**103 * Returns whether the box contains a coordinate or another box....Using AI Code Generation
1const { Box } = require("storybook-root");2const { Button } = require("storybook-root");3const { Text } = require("storybook-root");4const { Flex } = require("storybook-root");5const { Input } = require("storybook-root");6const { Link } = require("storybook-root");7const { Image } = require("storybook-root");8const { Spinner } = require("storybook-root");9const { Checkbox } = require("storybook-root");10const { Radio } = require("storybook-root");11const { Select } = require("storybook-root");12const { Slider } = require("storybook-root");13const { Switch } = require("storybook-root");14const { Textarea } = require("storybook-root");15const { Heading } = require("storybook-root");16const { Progress } = require("storybook-root");17const { Badge } = require("storybook-root");18const { Alert } = require("storybook-root");19const { CloseButton } = require("storybook-root");20const { AspectRatio } = require("storybook-root");21const { Avatar } = require("storybook-root");22const { Menu } = require("storybook-root");23const { MenuItem } = require("storybook-root");24const { MenuButton } = require("storybookUsing AI Code Generation
1import { Box } from "storybook-root/Box";2import { Button } from "storybook-root/Button";3import { Text } from "storybook-root/Text";4import { Box } from "storybook-root";5import { Button } from "storybook-root";6import { Text } from "storybook-root";7import { Box } from "storybook-root";8import { Button } from "storybook-root";9import { Text } from "storybook-root";10import { Box } from "storybook-root";11import { Button } from "storybook-root";12import { Text } from "storybook-root";13import { Box } from "storybook-root";14import { Button } from "storybook-root";15import { Text } from "storybook-root";16import { Box } from "storybook-root";17import { Button } from "storybook-root";18import { Text } from "storybook-root";19import { Box } from "storybook-root";20import { Button } from "storybook-root";21import { Text } from "storybook-root";22import { Box } from "storybook-root";23import { Button } from "storybook-root";Using AI Code Generation
1import { Box } from 'storybook-root';2const MyComponent = () => {3  return (4  );5};6export default MyComponent;7MIT © [michaeljlin](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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
