Best JavaScript code snippet using istanbul
flavour_pairing.js
Source:flavour_pairing.js
1https://gist.github.com/epmoyer/608c32b71c68bdda631d2var pairing = {3 nodes:[4 {nodeName:"Myriel", group:1},5 {nodeName:"Napoleon", group:1},6 {nodeName:"Mlle. Baptistine", group:1},7 {nodeName:"Mme. Magloire", group:1},8 {nodeName:"Countess de Lo", group:1},9 {nodeName:"Geborand", group:1},10 {nodeName:"Champtercier", group:1},11 {nodeName:"Cravatte", group:1},12 {nodeName:"Count", group:1},13 {nodeName:"Old Man", group:1},14 {nodeName:"Labarre", group:2},15 {nodeName:"Valjean", group:2},16 {nodeName:"Marguerite", group:3},17 {nodeName:"Mme. de R", group:2},18 {nodeName:"Isabeau", group:2},19 {nodeName:"Gervais", group:2},20 {nodeName:"Tholomyes", group:3},21 {nodeName:"Listolier", group:3},22 {nodeName:"Fameuil", group:3},23 {nodeName:"Blacheville", group:3},24 {nodeName:"Favourite", group:3},25 {nodeName:"Dahlia", group:3},26 {nodeName:"Zephine", group:3},27 {nodeName:"Fantine", group:3},28 {nodeName:"Mme. Thenardier", group:4},29 {nodeName:"Thenardier", group:4},30 {nodeName:"Cosette", group:5},31 {nodeName:"Javert", group:4},32 {nodeName:"Fauchelevent", group:0},33 {nodeName:"Bamatabois", group:2},34 {nodeName:"Perpetue", group:3},35 {nodeName:"Simplice", group:2},36 {nodeName:"Scaufflaire", group:2},37 {nodeName:"Woman 1", group:2},38 {nodeName:"Judge", group:2},39 {nodeName:"Champmathieu", group:2},40 {nodeName:"Brevet", group:2},41 {nodeName:"Chenildieu", group:2},42 {nodeName:"Cochepaille", group:2},43 {nodeName:"Pontmercy", group:4},44 {nodeName:"Boulatruelle", group:6},45 {nodeName:"Eponine", group:4},46 {nodeName:"Anzelma", group:4},47 {nodeName:"Woman 2", group:5},48 {nodeName:"Mother Innocent", group:0},49 {nodeName:"Gribier", group:0},50 {nodeName:"Jondrette", group:7},51 {nodeName:"Mme. Burgon", group:7},52 {nodeName:"Gavroche", group:8},53 {nodeName:"Gillenormand", group:5},54 {nodeName:"Magnon", group:5},55 {nodeName:"Mlle. Gillenormand", group:5},56 {nodeName:"Mme. Pontmercy", group:5},57 {nodeName:"Mlle. Vaubois", group:5},58 {nodeName:"Lt. Gillenormand", group:5},59 {nodeName:"Marius", group:8},60 {nodeName:"Baroness T", group:5},61 {nodeName:"Mabeuf", group:8},62 {nodeName:"Enjolras", group:8},63 {nodeName:"Combeferre", group:8},64 {nodeName:"Prouvaire", group:8},65 {nodeName:"Feuilly", group:8},66 {nodeName:"Courfeyrac", group:8},67 {nodeName:"Bahorel", group:8},68 {nodeName:"Bossuet", group:8},69 {nodeName:"Joly", group:8},70 {nodeName:"Grantaire", group:8},71 {nodeName:"Mother Plutarch", group:9},72 {nodeName:"Gueulemer", group:4},73 {nodeName:"Babet", group:4},74 {nodeName:"Claquesous", group:4},75 {nodeName:"Montparnasse", group:4},76 {nodeName:"Toussaint", group:5},77 {nodeName:"Child 1", group:10},78 {nodeName:"Child 2", group:10},79 {nodeName:"Brujon", group:4},80 {nodeName:"Mme. Hucheloup", group:8}81 ],82 links:[83 {source:1, target:0, value:1},84 {source:2, target:0, value:8},85 {source:3, target:0, value:10},86 {source:3, target:2, value:6},87 {source:4, target:0, value:1},88 {source:5, target:0, value:1},89 {source:6, target:0, value:1},90 {source:7, target:0, value:1},91 {source:8, target:0, value:2},92 {source:9, target:0, value:1},93 {source:11, target:10, value:1},94 {source:11, target:3, value:3},95 {source:11, target:2, value:3},96 {source:11, target:0, value:5},97 {source:12, target:11, value:1},98 {source:13, target:11, value:1},99 {source:14, target:11, value:1},100 {source:15, target:11, value:1},101 {source:17, target:16, value:4},102 {source:18, target:16, value:4},103 {source:18, target:17, value:4},104 {source:19, target:16, value:4},105 {source:19, target:17, value:4},106 {source:19, target:18, value:4},107 {source:20, target:16, value:3},108 {source:20, target:17, value:3},109 {source:20, target:18, value:3},110 {source:20, target:19, value:4},111 {source:21, target:16, value:3},112 {source:21, target:17, value:3},113 {source:21, target:18, value:3},114 {source:21, target:19, value:3},115 {source:21, target:20, value:5},116 {source:22, target:16, value:3},117 {source:22, target:17, value:3},118 {source:22, target:18, value:3},119 {source:22, target:19, value:3},120 {source:22, target:20, value:4},121 {source:22, target:21, value:4},122 {source:23, target:16, value:3},123 {source:23, target:17, value:3},124 {source:23, target:18, value:3},125 {source:23, target:19, value:3},126 {source:23, target:20, value:4},127 {source:23, target:21, value:4},128 {source:23, target:22, value:4},129 {source:23, target:12, value:2},130 {source:23, target:11, value:9},131 {source:24, target:23, value:2},132 {source:24, target:11, value:7},133 {source:25, target:24, value:13},134 {source:25, target:23, value:1},135 {source:25, target:11, value:12},136 {source:26, target:24, value:4},137 {source:26, target:11, value:31},138 {source:26, target:16, value:1},139 {source:26, target:25, value:1},140 {source:27, target:11, value:17},141 {source:27, target:23, value:5},142 {source:27, target:25, value:5},143 {source:27, target:24, value:1},144 {source:27, target:26, value:1},145 {source:28, target:11, value:8},146 {source:28, target:27, value:1},147 {source:29, target:23, value:1},148 {source:29, target:27, value:1},149 {source:29, target:11, value:2},150 {source:30, target:23, value:1},151 {source:31, target:30, value:2},152 {source:31, target:11, value:3},153 {source:31, target:23, value:2},154 {source:31, target:27, value:1},155 {source:32, target:11, value:1},156 {source:33, target:11, value:2},157 {source:33, target:27, value:1},158 {source:34, target:11, value:3},159 {source:34, target:29, value:2},160 {source:35, target:11, value:3},161 {source:35, target:34, value:3},162 {source:35, target:29, value:2},163 {source:36, target:34, value:2},164 {source:36, target:35, value:2},165 {source:36, target:11, value:2},166 {source:36, target:29, value:1},167 {source:37, target:34, value:2},168 {source:37, target:35, value:2},169 {source:37, target:36, value:2},170 {source:37, target:11, value:2},171 {source:37, target:29, value:1},172 {source:38, target:34, value:2},173 {source:38, target:35, value:2},174 {source:38, target:36, value:2},175 {source:38, target:37, value:2},176 {source:38, target:11, value:2},177 {source:38, target:29, value:1},178 {source:39, target:25, value:1},179 {source:40, target:25, value:1},180 {source:41, target:24, value:2},181 {source:41, target:25, value:3},182 {source:42, target:41, value:2},183 {source:42, target:25, value:2},184 {source:42, target:24, value:1},185 {source:43, target:11, value:3},186 {source:43, target:26, value:1},187 {source:43, target:27, value:1},188 {source:44, target:28, value:3},189 {source:44, target:11, value:1},190 {source:45, target:28, value:2},191 {source:47, target:46, value:1},192 {source:48, target:47, value:2},193 {source:48, target:25, value:1},194 {source:48, target:27, value:1},195 {source:48, target:11, value:1},196 {source:49, target:26, value:3},197 {source:49, target:11, value:2},198 {source:50, target:49, value:1},199 {source:50, target:24, value:1},200 {source:51, target:49, value:9},201 {source:51, target:26, value:2},202 {source:51, target:11, value:2},203 {source:52, target:51, value:1},204 {source:52, target:39, value:1},205 {source:53, target:51, value:1},206 {source:54, target:51, value:2},207 {source:54, target:49, value:1},208 {source:54, target:26, value:1},209 {source:55, target:51, value:6},210 {source:55, target:49, value:12},211 {source:55, target:39, value:1},212 {source:55, target:54, value:1},213 {source:55, target:26, value:21},214 {source:55, target:11, value:19},215 {source:55, target:16, value:1},216 {source:55, target:25, value:2},217 {source:55, target:41, value:5},218 {source:55, target:48, value:4},219 {source:56, target:49, value:1},220 {source:56, target:55, value:1},221 {source:57, target:55, value:1},222 {source:57, target:41, value:1},223 {source:57, target:48, value:1},224 {source:58, target:55, value:7},225 {source:58, target:48, value:7},226 {source:58, target:27, value:6},227 {source:58, target:57, value:1},228 {source:58, target:11, value:4},229 {source:59, target:58, value:15},230 {source:59, target:55, value:5},231 {source:59, target:48, value:6},232 {source:59, target:57, value:2},233 {source:60, target:48, value:1},234 {source:60, target:58, value:4},235 {source:60, target:59, value:2},236 {source:61, target:48, value:2},237 {source:61, target:58, value:6},238 {source:61, target:60, value:2},239 {source:61, target:59, value:5},240 {source:61, target:57, value:1},241 {source:61, target:55, value:1},242 {source:62, target:55, value:9},243 {source:62, target:58, value:17},244 {source:62, target:59, value:13},245 {source:62, target:48, value:7},246 {source:62, target:57, value:2},247 {source:62, target:41, value:1},248 {source:62, target:61, value:6},249 {source:62, target:60, value:3},250 {source:63, target:59, value:5},251 {source:63, target:48, value:5},252 {source:63, target:62, value:6},253 {source:63, target:57, value:2},254 {source:63, target:58, value:4},255 {source:63, target:61, value:3},256 {source:63, target:60, value:2},257 {source:63, target:55, value:1},258 {source:64, target:55, value:5},259 {source:64, target:62, value:12},260 {source:64, target:48, value:5},261 {source:64, target:63, value:4},262 {source:64, target:58, value:10},263 {source:64, target:61, value:6},264 {source:64, target:60, value:2},265 {source:64, target:59, value:9},266 {source:64, target:57, value:1},267 {source:64, target:11, value:1},268 {source:65, target:63, value:5},269 {source:65, target:64, value:7},270 {source:65, target:48, value:3},271 {source:65, target:62, value:5},272 {source:65, target:58, value:5},273 {source:65, target:61, value:5},274 {source:65, target:60, value:2},275 {source:65, target:59, value:5},276 {source:65, target:57, value:1},277 {source:65, target:55, value:2},278 {source:66, target:64, value:3},279 {source:66, target:58, value:3},280 {source:66, target:59, value:1},281 {source:66, target:62, value:2},282 {source:66, target:65, value:2},283 {source:66, target:48, value:1},284 {source:66, target:63, value:1},285 {source:66, target:61, value:1},286 {source:66, target:60, value:1},287 {source:67, target:57, value:3},288 {source:68, target:25, value:5},289 {source:68, target:11, value:1},290 {source:68, target:24, value:1},291 {source:68, target:27, value:1},292 {source:68, target:48, value:1},293 {source:68, target:41, value:1},294 {source:69, target:25, value:6},295 {source:69, target:68, value:6},296 {source:69, target:11, value:1},297 {source:69, target:24, value:1},298 {source:69, target:27, value:2},299 {source:69, target:48, value:1},300 {source:69, target:41, value:1},301 {source:70, target:25, value:4},302 {source:70, target:69, value:4},303 {source:70, target:68, value:4},304 {source:70, target:11, value:1},305 {source:70, target:24, value:1},306 {source:70, target:27, value:1},307 {source:70, target:41, value:1},308 {source:70, target:58, value:1},309 {source:71, target:27, value:1},310 {source:71, target:69, value:2},311 {source:71, target:68, value:2},312 {source:71, target:70, value:2},313 {source:71, target:11, value:1},314 {source:71, target:48, value:1},315 {source:71, target:41, value:1},316 {source:71, target:25, value:1},317 {source:72, target:26, value:2},318 {source:72, target:27, value:1},319 {source:72, target:11, value:1},320 {source:73, target:48, value:2},321 {source:74, target:48, value:2},322 {source:74, target:73, value:3},323 {source:75, target:69, value:3},324 {source:75, target:68, value:3},325 {source:75, target:25, value:3},326 {source:75, target:48, value:1},327 {source:75, target:41, value:1},328 {source:75, target:70, value:1},329 {source:75, target:71, value:1},330 {source:76, target:64, value:1},331 {source:76, target:65, value:1},332 {source:76, target:66, value:1},333 {source:76, target:63, value:1},334 {source:76, target:62, value:1},335 {source:76, target:48, value:1},336 {source:76, target:58, value:1}337 ]...
gentest-go.js
Source:gentest-go.js
1/**2 * Copyright (c) 2014-present, Facebook, Inc.3 *4 * This source code is licensed under the MIT license found in the5 * LICENSE file in the root directory of this source tree.6 */7function toValueGo(value) {8 return value.toString().replace('px','').replace('%','');9}10function toMethodName(value) {11 if (value.indexOf('%') >= 0){12 return 'Percent';13 } else if(value.indexOf('Auto') >= 0) {14 return 'Auto';15 }16 return '';17}18function toExportName(name) {19 name = name.replace(/(\_\w)/g, function(m) { return m[1].toUpperCase(); });20 if (name.length > 0) {21 name = name[0].toUpperCase() + name.substring(1);22 }23 return name;24}25var GoEmitter = function() {26 Emitter.call(this, 'go', ' ');27};28GoEmitter.prototype = Object.create(Emitter.prototype, {29 constructor:{value:GoEmitter},30 emitPrologue:{value:function() {}},31 emitTestPrologue:{value:function(name, experiments) {32 this.push('func Test' + toExportName(name) + '(t *testing.T) {');33 this.pushIndent();34 this.push('config := NewConfig()')35 this.push('defer config.Free()')36 for (var i in experiments) {37 this.push('config.SetExperimentalFeatureEnabled(Experiment' + experiments[i] +', true)');38 }39 this.push('');40 }},41 emitTestTreePrologue:{value:function(nodeName) {42 this.push(nodeName + ' := NewNodeWithConfig(config)');43 this.push('defer ' +nodeName + '.Free()')44 }},45 emitTestEpilogue:{value:function(experiments) {46 this.popIndent();47 this.push('}');48 this.push('');49 }},50 emitEpilogue:{value:function(lines) {}},51 AssertEQ:{value:function(v0, v1) {52 this.push('assert.EqualValues(t, ' + v0 + ', ' + v1 + ')');53 }},54 YGAlignAuto:{value:'AlignAuto'},55 YGAlignCenter:{value:'AlignCenter'},56 YGAlignFlexEnd:{value:'AlignFlexEnd'},57 YGAlignFlexStart:{value:'AlignFlexStart'},58 YGAlignStretch:{value:'AlignStretch'},59 YGAlignSpaceBetween:{value:'AlignSpaceBetween'},60 YGAlignSpaceAround:{value:'AlignSpaceAround'},61 YGAlignBaseline:{value:'AlignBaseline'},62 YGDirectionInherit:{value:'DirectionInherit'},63 YGDirectionLTR:{value:'DirectionLTR'},64 YGDirectionRTL:{value:'DirectionRTL'},65 YGEdgeBottom:{value:'EdgeBottom'},66 YGEdgeEnd:{value:'EdgeEnd'},67 YGEdgeLeft:{value:'EdgeLeft'},68 YGEdgeRight:{value:'EdgeRight'},69 YGEdgeStart:{value:'EdgeStart'},70 YGEdgeTop:{value:'EdgeTop'},71 YGFlexDirectionColumn:{value:'FlexDirectionColumn'},72 YGFlexDirectionColumnReverse:{value:'FlexDirectionColumnReverse'},73 YGFlexDirectionRow:{value:'FlexDirectionRow'},74 YGFlexDirectionRowReverse:{value:'FlexDirectionRowReverse'},75 YGJustifyCenter:{value:'JustifyCenter'},76 YGJustifyFlexEnd:{value:'JustifyFlexEnd'},77 YGJustifyFlexStart:{value:'JustifyFlexStart'},78 YGJustifySpaceAround:{value:'JustifySpaceAround'},79 YGJustifySpaceBetween:{value:'JustifySpaceBetween'},80 YGJustifySpaceEvenly:{value:'JustifySpaceEvenly'},81 YGOverflowHidden:{value:'OverflowHidden'},82 YGOverflowVisible:{value:'OverflowVisible'},83 YGPositionTypeAbsolute:{value:'PositionAbsolute'},84 YGPositionTypeRelative:{value:'PositionRelative'},85 YGUndefined:{value:'Undefined'},86 YGDisplayFlex:{value:'DisplayFlex'},87 YGDisplayNone:{value:'DisplayNone'},88 YGAuto:{value:'Auto'},89 YGWrapNoWrap:{value:'WrapNone'},90 YGWrapWrap:{value:'WrapWrap'},91 YGWrapWrapReverse:{value: 'WrapReverse'},92 YGNodeCalculateLayout:{value:function(node, dir, experiments) {93 this.push(node + '.Style().SetDirection(' + dir + ')');94 this.push(node + '.CalculateLayout(Undefined, Undefined, ' + dir +')');95 }},96 YGNodeInsertChild:{value:function(parentName, nodeName, index) {97 this.push(parentName + '.InsertChild(' + nodeName + ', ' + index + ')');98 }},99 YGNodeLayoutGetLeft:{value:function(nodeName) {100 return nodeName + '.Layout().Left()';101 }},102 YGNodeLayoutGetTop:{value:function(nodeName) {103 return nodeName + '.Layout().Top()';104 }},105 YGNodeLayoutGetWidth:{value:function(nodeName) {106 return nodeName + '.Layout().Width()';107 }},108 YGNodeLayoutGetHeight:{value:function(nodeName) {109 return nodeName + '.Layout().Height()';110 }},111 YGNodeStyleSetAlignContent:{value:function(nodeName, value) {112 this.push(nodeName + '.Style().SetAlignContent(' + toValueGo(value) + ')');113 }},114 YGNodeStyleSetAlignItems:{value:function(nodeName, value) {115 this.push(nodeName + '.Style().SetAlignItems(' + toValueGo(value) + ')');116 }},117 YGNodeStyleSetAlignSelf:{value:function(nodeName, value) {118 this.push(nodeName + '.Style().SetAlignSelf(' + toValueGo(value) + ')');119 }},120 YGNodeStyleSetBorder:{value:function(nodeName, edge, value) {121 this.push(nodeName + '.Style().SetBorder(' + edge + ', ' + toValueGo(value) + ')');122 }},123 YGNodeStyleSetDirection:{value:function(nodeName, value) {124 this.push(nodeName + '.Style().SetDirection(' + toValueGo(value) + ')');125 }},126 YGNodeStyleSetDisplay:{value:function(nodeName, value) {127 this.push(nodeName + '.Style().SetDisplay(' + toValueGo(value) + ')');128 }},129 YGNodeStyleSetFlexBasis:{value:function(nodeName, value) {130 this.push(nodeName + '.Style().SetFlexBasis' + toMethodName(value) + '(' + toValueGo(value) + ')');131 }},132 YGNodeStyleSetFlexDirection:{value:function(nodeName, value) {133 this.push(nodeName + '.Style().SetFlexDirection(' + toValueGo(value) + ')');134 }},135 YGNodeStyleSetFlexGrow:{value:function(nodeName, value) {136 this.push(nodeName + '.Style().SetFlexGrow(' + toValueGo(value) + ')');137 }},138 YGNodeStyleSetFlexShrink:{value:function(nodeName, value) {139 this.push(nodeName + '.Style().SetFlexShrink(' + toValueGo(value) + ')');140 }},141 YGNodeStyleSetFlexWrap:{value:function(nodeName, value) {142 this.push(nodeName + '.Style().SetFlexWrap(' + toValueGo(value) + ')');143 }},144 YGNodeStyleSetHeight:{value:function(nodeName, value) {145 this.push(nodeName + '.Style().SetHeight' + toMethodName(value) + '(' + toValueGo(value) + ')');146 }},147 YGNodeStyleSetJustifyContent:{value:function(nodeName, value) {148 this.push(nodeName + '.Style().SetJustifyContent(' + toValueGo(value) + ')');149 }},150 YGNodeStyleSetMargin:{value:function(nodeName, edge, value) {151 var valueStr = toValueGo(value);152 if (valueStr != 'Auto') {153 valueStr = ', ' + valueStr + '';154 } else {155 valueStr = '';156 }157 this.push(nodeName + '.Style().SetMargin' + toMethodName(value) + '(' + edge + valueStr + ')');158 }},159 YGNodeStyleSetMaxHeight:{value:function(nodeName, value) {160 this.push(nodeName + '.Style().SetMaxHeight' + toMethodName(value) + '(' + toValueGo(value) + ')');161 }},162 YGNodeStyleSetMaxWidth:{value:function(nodeName, value) {163 this.push(nodeName + '.Style().SetMaxWidth' + toMethodName(value) + '(' + toValueGo(value) + ')');164 }},165 YGNodeStyleSetMinHeight:{value:function(nodeName, value) {166 this.push(nodeName + '.Style().SetMinHeight' + toMethodName(value) + '(' + toValueGo(value) + ')');167 }},168 YGNodeStyleSetMinWidth:{value:function(nodeName, value) {169 this.push(nodeName + '.Style().SetMinWidth' + toMethodName(value) + '(' + toValueGo(value) + ')');170 }},171 YGNodeStyleSetOverflow:{value:function(nodeName, value) {172 this.push(nodeName + '.Style().SetOverflow(' + toValueGo(value) + ')');173 }},174 YGNodeStyleSetPadding:{value:function(nodeName, edge, value) {175 this.push(nodeName + '.Style().SetPadding' + toMethodName(value) + '(' + edge + ', ' + toValueGo(value) + ')');176 }},177 YGNodeStyleSetPosition:{value:function(nodeName, edge, value) {178 this.push(nodeName + '.Style().SetPosition' + toMethodName(value) + '(' + edge + ', ' + toValueGo(value) + ')');179 }},180 YGNodeStyleSetPositionType:{value:function(nodeName, value) {181 this.push(nodeName + '.Style().SetPositionType(' + toValueGo(value) + ')');182 }},183 YGNodeStyleSetWidth:{value:function(nodeName, value) {184 this.push(nodeName + '.Style().SetWidth' + toMethodName(value) + '(' + toValueGo(value) + ')');185 }},...
PropertyBinding.tests.js
Source:PropertyBinding.tests.js
1/**2 * @author TristanVALCKE / https://github.com/Itee3 * @author Anonymous4 */5/* global QUnit */6import { PropertyBinding } from '../../../../src/animation/PropertyBinding';7import { BoxGeometry } from '../../../../src/geometries/BoxGeometry';8import { Mesh } from '../../../../src/objects/Mesh';9import { MeshBasicMaterial } from '../../../../src/materials/MeshBasicMaterial';10export default QUnit.module( 'Animation', () => {11 QUnit.module( 'PropertyBinding', () => {12 // INSTANCING13 QUnit.todo( "Instancing", ( assert ) => {14 assert.ok( false, "everything's gonna be alright" );15 } );16 // STATIC STUFF17 QUnit.todo( "Composite", ( assert ) => {18 assert.ok( false, "everything's gonna be alright" );19 } );20 QUnit.todo( "create", ( assert ) => {21 assert.ok( false, "everything's gonna be alright" );22 } );23 QUnit.test( 'sanitizeNodeName', ( assert ) => {24 assert.equal(25 PropertyBinding.sanitizeNodeName( 'valid-name-123_' ),26 'valid-name-123_',27 'Leaves valid name intact.'28 );29 assert.equal(30 PropertyBinding.sanitizeNodeName( 'space separated name 123_ -' ),31 'space_separated_name_123__-',32 'Replaces spaces with underscores.'33 );34 assert.equal(35 PropertyBinding.sanitizeNodeName( '"invalid" name %123%_' ),36 'invalid_name_123_',37 'Strips invalid characters.'38 );39 } );40 QUnit.test( 'parseTrackName', ( assert ) => {41 var paths = [42 [43 '.property',44 {45 nodeName: undefined,46 objectName: undefined,47 objectIndex: undefined,48 propertyName: 'property',49 propertyIndex: undefined50 }51 ],52 [53 'nodeName.property',54 {55 nodeName: 'nodeName',56 objectName: undefined,57 objectIndex: undefined,58 propertyName: 'property',59 propertyIndex: undefined60 }61 ],62 [63 'a.property',64 {65 nodeName: 'a',66 objectName: undefined,67 objectIndex: undefined,68 propertyName: 'property',69 propertyIndex: undefined70 }71 ],72 [73 'no.de.Name.property',74 {75 nodeName: 'no.de.Name',76 objectName: undefined,77 objectIndex: undefined,78 propertyName: 'property',79 propertyIndex: undefined80 }81 ],82 [83 'no.d-e.Name.property',84 {85 nodeName: 'no.d-e.Name',86 objectName: undefined,87 objectIndex: undefined,88 propertyName: 'property',89 propertyIndex: undefined90 }91 ],92 [93 'nodeName.property[accessor]',94 {95 nodeName: 'nodeName',96 objectName: undefined,97 objectIndex: undefined,98 propertyName: 'property',99 propertyIndex: 'accessor'100 }101 ],102 [103 'nodeName.material.property[accessor]',104 {105 nodeName: 'nodeName',106 objectName: 'material',107 objectIndex: undefined,108 propertyName: 'property',109 propertyIndex: 'accessor'110 }111 ],112 [113 'no.de.Name.material.property',114 {115 nodeName: 'no.de.Name',116 objectName: 'material',117 objectIndex: undefined,118 propertyName: 'property',119 propertyIndex: undefined120 }121 ],122 [123 'no.de.Name.material[materialIndex].property',124 {125 nodeName: 'no.de.Name',126 objectName: 'material',127 objectIndex: 'materialIndex',128 propertyName: 'property',129 propertyIndex: undefined130 }131 ],132 [133 'uuid.property[accessor]',134 {135 nodeName: 'uuid',136 objectName: undefined,137 objectIndex: undefined,138 propertyName: 'property',139 propertyIndex: 'accessor'140 }141 ],142 [143 'uuid.objectName[objectIndex].propertyName[propertyIndex]',144 {145 nodeName: 'uuid',146 objectName: 'objectName',147 objectIndex: 'objectIndex',148 propertyName: 'propertyName',149 propertyIndex: 'propertyIndex'150 }151 ],152 [153 'parentName/nodeName.property',154 {155 // directoryName is currently unused.156 nodeName: 'nodeName',157 objectName: undefined,158 objectIndex: undefined,159 propertyName: 'property',160 propertyIndex: undefined161 }162 ],163 [164 'parentName/no.de.Name.property',165 {166 // directoryName is currently unused.167 nodeName: 'no.de.Name',168 objectName: undefined,169 objectIndex: undefined,170 propertyName: 'property',171 propertyIndex: undefined172 }173 ],174 [175 'parentName/parentName/nodeName.property[index]',176 {177 // directoryName is currently unused.178 nodeName: 'nodeName',179 objectName: undefined,180 objectIndex: undefined,181 propertyName: 'property',182 propertyIndex: 'index'183 }184 ],185 [186 '.bone[Armature.DEF_cog].position',187 {188 nodeName: undefined,189 objectName: 'bone',190 objectIndex: 'Armature.DEF_cog',191 propertyName: 'position',192 propertyIndex: undefined193 }194 ],195 [196 'scene:helium_balloon_model:helium_balloon_model.position',197 {198 nodeName: 'helium_balloon_model',199 objectName: undefined,200 objectIndex: undefined,201 propertyName: 'position',202 propertyIndex: undefined203 }204 ]205 ];206 paths.forEach( function ( path ) {207 assert.smartEqual(208 PropertyBinding.parseTrackName( path[ 0 ] ),209 path[ 1 ],210 'Parses track name: ' + path[ 0 ]211 );212 } );213 } );214 QUnit.todo( "findNode", ( assert ) => {215 assert.ok( false, "everything's gonna be alright" );216 } );217 // PUBLIC STUFF218 QUnit.todo( "BindingType", ( assert ) => {219 assert.ok( false, "everything's gonna be alright" );220 } );221 QUnit.todo( "Versioning", ( assert ) => {222 assert.ok( false, "everything's gonna be alright" );223 } );224 QUnit.todo( "GetterByBindingType", ( assert ) => {225 assert.ok( false, "everything's gonna be alright" );226 } );227 QUnit.todo( "SetterByBindingTypeAndVersioning", ( assert ) => {228 assert.ok( false, "everything's gonna be alright" );229 } );230 QUnit.todo( "getValue", ( assert ) => {231 assert.ok( false, "everything's gonna be alright" );232 } );233 QUnit.test( 'setValue', ( assert ) => {234 var paths = [235 '.material.opacity',236 '.material[opacity]'237 ];238 paths.forEach( function ( path ) {239 var originalValue = 0;240 var expectedValue = 1;241 var geometry = new BoxGeometry();242 var material = new MeshBasicMaterial();243 material.opacity = originalValue;244 var mesh = new Mesh( geometry, material );245 var binding = new PropertyBinding( mesh, path, null );246 binding.bind();247 assert.equal(248 material.opacity,249 originalValue,250 'Sets property of material with "' + path + '" (pre-setValue)'251 );252 binding.setValue( [ expectedValue ], 0 );253 assert.equal(254 material.opacity,255 expectedValue,256 'Sets property of material with "' + path + '" (post-setValue)'257 );258 } );259 } );260 QUnit.todo( "bind", ( assert ) => {261 assert.ok( false, "everything's gonna be alright" );262 } );263 QUnit.todo( "unbind", ( assert ) => {264 assert.ok( false, "everything's gonna be alright" );265 } );266 } );...
nodereplacechild30.js
Source:nodereplacechild30.js
1/*2Copyright é 2001-2004 World Wide Web Consortium, 3(Massachusetts Institute of Technology, European Research Consortium 4for Informatics and Mathematics, Keio University). All 5Rights Reserved. This work is distributed under the W3Cî Software License [1] in the 6hope that it will be useful, but WITHOUT ANY WARRANTY; without even 7the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-200212319*/10 /**11 * Gets URI that identifies the test.12 * @return uri identifier of test13 */14function getTargetURI() {15 return "http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodereplacechild30";16 }17var docsLoaded = -1000000;18var builder = null;19//20// This function is called by the testing framework before21// running the test suite.22//23// If there are no configuration exceptions, asynchronous24// document loading is started. Otherwise, the status25// is set to complete and the exception is immediately26// raised when entering the body of the test.27//28function setUpPage() {29 setUpPageStatus = 'running';30 try {31 //32 // creates test document builder, may throw exception33 //34 builder = createConfiguredBuilder();35 docsLoaded = 0;36 37 var docRef = null;38 if (typeof(this.doc) != 'undefined') {39 docRef = this.doc;40 }41 docsLoaded += preload(docRef, "doc", "hc_staff");42 43 if (docsLoaded == 1) {44 setUpPageStatus = 'complete';45 }46 } catch(ex) {47 catchInitializationError(builder, ex);48 setUpPageStatus = 'complete';49 }50}51//52// This method is called on the completion of 53// each asychronous load started in setUpTests.54//55// When every synchronous loaded document has completed,56// the page status is changed which allows the57// body of the test to be executed.58function loadComplete() {59 if (++docsLoaded == 1) {60 setUpPageStatus = 'complete';61 }62}63/**64* 65 Using replaceChild on an Element node attempt to replace a new Element child node with 66 new child nodes and vice versa and in each case verify the name of the replaced node.67* @author IBM68* @author Neil Delima69* @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-78588730770*/71function nodereplacechild30() {72 var success;73 if(checkInitialization(builder, "nodereplacechild30") != null) return;74 var doc;75 var parent;76 var oldChild;77 var newElement;78 var newText;79 var newComment;80 var newPI;81 var newCdata;82 var newERef;83 var replaced;84 var nodeName;85 var appendedChild;86 87 var docRef = null;88 if (typeof(this.doc) != 'undefined') {89 docRef = this.doc;90 }91 doc = load(docRef, "doc", "hc_staff");92 parent = doc.createElementNS("http://www.w3.org/1999/xhtml","xhtml:html");93 oldChild = doc.createElementNS("http://www.w3.org/1999/xhtml","xhtml:head");94 newElement = doc.createElementNS("http://www.w3.org/1999/xhtml","xhtml:body");95 appendedChild = parent.appendChild(oldChild);96 appendedChild = parent.appendChild(newElement);97 newText = doc.createTextNode("Text");98 appendedChild = parent.appendChild(newText);99 newComment = doc.createComment("Comment");100 appendedChild = parent.appendChild(newComment);101 newPI = doc.createProcessingInstruction("target","data");102 appendedChild = parent.appendChild(newPI);103 newCdata = doc.createCDATASection("Cdata");104 appendedChild = parent.appendChild(newCdata);105 newERef = doc.createEntityReference("delta");106 appendedChild = parent.appendChild(newERef);107 replaced = parent.replaceChild(newElement,oldChild);108 nodeName = replaced.nodeName;109 assertEquals("nodereplacechild30_1","xhtml:head",nodeName);110 replaced = parent.replaceChild(oldChild,newElement);111 nodeName = replaced.nodeName;112 assertEquals("nodereplacechild30_2","xhtml:body",nodeName);113 replaced = parent.replaceChild(newText,oldChild);114 nodeName = replaced.nodeName;115 assertEquals("nodereplacechild30_3","xhtml:head",nodeName);116 replaced = parent.replaceChild(oldChild,newText);117 nodeName = replaced.nodeName;118 assertEquals("nodereplacechild30_4","#text",nodeName);119 replaced = parent.replaceChild(newComment,oldChild);120 nodeName = replaced.nodeName;121 assertEquals("nodereplacechild30_5","xhtml:head",nodeName);122 replaced = parent.replaceChild(oldChild,newComment);123 nodeName = replaced.nodeName;124 assertEquals("nodereplacechild30_6","#comment",nodeName);125 replaced = parent.replaceChild(oldChild,newPI);126 nodeName = replaced.nodeName;127 assertEquals("nodereplacechild30_7","target",nodeName);128 replaced = parent.replaceChild(oldChild,newCdata);129 nodeName = replaced.nodeName;130 assertEquals("nodereplacechild30_8","#cdata-section",nodeName);131 replaced = parent.replaceChild(oldChild,newERef);132 nodeName = replaced.nodeName;133 assertEquals("nodereplacechild30_9","delta",nodeName);134 135}136function runTest() {137 nodereplacechild30();...
PropertyBinding.js
Source:PropertyBinding.js
1/**2 * @author TristanVALCKE / https://github.com/TristanVALCKE3 */4QUnit.module( 'PropertyBinding' );5QUnit.test( 'parseTrackName' , function( assert ) {6 var paths = [7 [8 '.property',9 {10 nodeName: undefined,11 objectName: undefined,12 objectIndex: undefined,13 propertyName: 'property',14 propertyIndex: undefined15 }16 ],17 [18 'nodeName.property',19 {20 nodeName: 'nodeName',21 objectName: undefined,22 objectIndex: undefined,23 propertyName: 'property',24 propertyIndex: undefined25 }26 ],27 [28 'a.property',29 {30 nodeName: 'a',31 objectName: undefined,32 objectIndex: undefined,33 propertyName: 'property',34 propertyIndex: undefined35 }36 ],37 [38 'no.de.Name.property',39 {40 nodeName: 'no.de.Name',41 objectName: undefined,42 objectIndex: undefined,43 propertyName: 'property',44 propertyIndex: undefined45 }46 ],47 [48 'no.d-e.Name.property',49 {50 nodeName: 'no.d-e.Name',51 objectName: undefined,52 objectIndex: undefined,53 propertyName: 'property',54 propertyIndex: undefined55 }56 ],57 [58 'nodeName.property[accessor]',59 {60 nodeName: 'nodeName',61 objectName: undefined,62 objectIndex: undefined,63 propertyName: 'property',64 propertyIndex: 'accessor'65 }66 ],67 [68 'nodeName.material.property[accessor]',69 {70 nodeName: 'nodeName',71 objectName: 'material',72 objectIndex: undefined,73 propertyName: 'property',74 propertyIndex: 'accessor'75 }76 ],77 [78 'no.de.Name.material.property',79 {80 nodeName: 'no.de.Name',81 objectName: 'material',82 objectIndex: undefined,83 propertyName: 'property',84 propertyIndex: undefined85 }86 ],87 [88 'no.de.Name.material[materialIndex].property',89 {90 nodeName: 'no.de.Name',91 objectName: 'material',92 objectIndex: 'materialIndex',93 propertyName: 'property',94 propertyIndex: undefined95 }96 ],97 [98 'uuid.property[accessor]',99 {100 nodeName: 'uuid',101 objectName: undefined,102 objectIndex: undefined,103 propertyName: 'property',104 propertyIndex: 'accessor'105 }106 ],107 [108 'uuid.objectName[objectIndex].propertyName[propertyIndex]',109 {110 nodeName: 'uuid',111 objectName: 'objectName',112 objectIndex: 'objectIndex',113 propertyName: 'propertyName',114 propertyIndex: 'propertyIndex'115 }116 ],117 [118 'parentName/nodeName.property',119 {120 // directoryName is currently unused.121 nodeName: 'nodeName',122 objectName: undefined,123 objectIndex: undefined,124 propertyName: 'property',125 propertyIndex: undefined126 }127 ],128 [129 'parentName/no.de.Name.property',130 {131 // directoryName is currently unused.132 nodeName: 'no.de.Name',133 objectName: undefined,134 objectIndex: undefined,135 propertyName: 'property',136 propertyIndex: undefined137 }138 ],139 [140 'parentName/parentName/nodeName.property[index]',141 {142 // directoryName is currently unused.143 nodeName: 'nodeName',144 objectName: undefined,145 objectIndex: undefined,146 propertyName: 'property',147 propertyIndex: 'index'148 }149 ],150 [151 '.bone[Armature.DEF_cog].position',152 {153 nodeName: undefined,154 objectName: 'bone',155 objectIndex: 'Armature.DEF_cog',156 propertyName: 'position',157 propertyIndex: undefined158 }159 ],160 [161 'scene:helium_balloon_model:helium_balloon_model.position',162 {163 nodeName: 'helium_balloon_model',164 objectName: undefined,165 objectIndex: undefined,166 propertyName: 'position',167 propertyIndex: undefined168 }169 ]170 ];171 paths.forEach( function ( path, i ) {172 assert.smartEqual(173 THREE.PropertyBinding.parseTrackName( path[ 0 ] ),174 path[ 1 ],175 'Parses track name: ' + path[ 0 ]176 );177 } );...
setupNodes.js
Source:setupNodes.js
1function SetupNodes() {2};3/*4 * This array specifies what step types will be available in the vle.5 * If you want a step type to be available in the vle, you must add6 * an object to the array below that contains the nodeName and 7 * nodeSetupPath8 */9SetupNodes.setupFiles = [10 {11 nodeName:"AssessmentListNode",12 nodeSetupPath:"vle/node/assessmentlist/setup.js"13 },14 {15 nodeName:"Box2dModelNode",16 nodeSetupPath:"vle/node/box2dModel/setup.js"17 },18 {19 nodeName:"BrainstormNode",20 nodeSetupPath:"vle/node/brainstorm/setup.js"21 },22 {23 nodeName:"DataGraphNode",24 nodeSetupPath:"vle/node/datagraph/setup.js"25 },26 {27 nodeName:"SVGDrawNode",28 nodeSetupPath:"vle/node/draw/setup.js"29 },30 {31 nodeName:"FillinNode",32 nodeSetupPath:"vle/node/fillin/setup.js"33 },34 {35 nodeName:"HtmlNode",36 nodeSetupPath:"vle/node/html/setup.js"37 },38 {39 nodeName:"MatchSequenceNode",40 nodeSetupPath:"vle/node/matchsequence/setup.js"41 },42 {43 nodeName:"MultipleChoiceNode",44 nodeSetupPath:"vle/node/multiplechoice/setup.js"45 },46 {47 nodeName:"ChallengeNode",48 nodeSetupPath:"vle/node/multiplechoice/setup.js"49 },50 {51 nodeName:"MWNode",52 nodeSetupPath:"vle/node/mw/setup.js"53 },54 {55 nodeName:"MySystemNode",56 nodeSetupPath:"vle/node/mysystem/setup.js"57 },58 {59 nodeName:"OpenResponseNode",60 nodeSetupPath:"vle/node/openresponse/setup.js"61 },62 {63 nodeName:"NoteNode",64 nodeSetupPath:"vle/node/openresponse/setup.js"65 },66 {67 nodeName:"OutsideUrlNode",68 nodeSetupPath:"vle/node/outsideurl/setup.js"69 },70 {71 nodeName:"SensorNode",72 nodeSetupPath:"vle/node/sensor/setup.js"73 },74 {75 nodeName:"TemplateNode",76 nodeSetupPath:"vle/node/template/setup.js"77 },78 {79 nodeName:"ExplanationBuilderNode",80 nodeSetupPath:"vle/node/explanationbuilder/setup.js"81 },82 {83 nodeName:"TableNode",84 nodeSetupPath:"vle/node/table/setup.js"85 },86 {87 nodeName:"IdeaBasketNode",88 nodeSetupPath:"vle/node/ideabasket/setup.js"89 },90 {91 nodeName:"CarGraphNode",92 nodeSetupPath:"vle/node/cargraph/setup.js"93 },94 {95 nodeName:"SeasonsNode",96 nodeSetupPath:"vle/node/seasons/setup.js"97 },98 {99 nodeName:"Seasons2Node",100 nodeSetupPath:"vle/node/seasons2/setup.js"101 },102 {103 nodeName:"SurgeNode",104 nodeSetupPath:"vle/node/surge/setup.js"105 },106 {107 nodeName:"Mysystem2Node",108 nodeSetupPath:"vle/node/mysystem2/setup.js"109 },110 {111 nodeName:"FlashNode",112 nodeSetupPath:"vle/node/flash/setup.js"113 },114 {115 nodeName:"BranchingNode",116 nodeSetupPath:"vle/node/branching/setup.js"117 },118 {119 nodeName:"NetlogoNode",120 nodeSetupPath:"vle/node/netlogo/setup.js"121 },122 {123 nodeName:"EpigameNode",124 nodeSetupPath:"vle/node/epigame/setup.js"125 },126 {127 nodeName:"GrapherNode",128 nodeSetupPath:"vle/node/grapher/setup.js"129 }130];131//insert the setup paths into the scriptloader so they will be loaded132scriptloader.insertSetupPaths(SetupNodes.setupFiles);133//used to notify scriptloader that this script has finished loading134if(typeof eventManager != 'undefined'){135 eventManager.fire('scriptLoaded', 'vle/node/setupNodes.js');...
getMarkupWrap.js
Source:getMarkupWrap.js
1"use strict";2/**3 * Copyright (c) 2013-present, Facebook, Inc.4 *5 * This source code is licensed under the MIT license found in the6 * LICENSE file in the root directory of this source tree.7 *8 */9/*eslint-disable fb-www/unsafe-html */10var ExecutionEnvironment = require("./ExecutionEnvironment");11var invariant = require("./invariant");12/**13 * Dummy container used to detect which wraps are necessary.14 */15var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;16/**17 * Some browsers cannot use `innerHTML` to render certain elements standalone,18 * so we wrap them, render the wrapped nodes, then extract the desired node.19 *20 * In IE8, certain elements cannot render alone, so wrap all elements ('*').21 */22var shouldWrap = {};23var selectWrap = [1, '<select multiple="true">', '</select>'];24var tableWrap = [1, '<table>', '</table>'];25var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];26var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];27var markupWrap = {28 '*': [1, '?<div>', '</div>'],29 'area': [1, '<map>', '</map>'],30 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],31 'legend': [1, '<fieldset>', '</fieldset>'],32 'param': [1, '<object>', '</object>'],33 'tr': [2, '<table><tbody>', '</tbody></table>'],34 'optgroup': selectWrap,35 'option': selectWrap,36 'caption': tableWrap,37 'colgroup': tableWrap,38 'tbody': tableWrap,39 'tfoot': tableWrap,40 'thead': tableWrap,41 'td': trWrap,42 'th': trWrap43}; // Initialize the SVG elements since we know they'll always need to be wrapped44// consistently. If they are created inside a <div> they will be initialized in45// the wrong namespace (and will not display).46var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];47svgElements.forEach(function (nodeName) {48 markupWrap[nodeName] = svgWrap;49 shouldWrap[nodeName] = true;50});51/**52 * Gets the markup wrap configuration for the supplied `nodeName`.53 *54 * NOTE: This lazily detects which wraps are necessary for the current browser.55 *56 * @param {string} nodeName Lowercase `nodeName`.57 * @return {?array} Markup wrap configuration, if applicable.58 */59function getMarkupWrap(nodeName) {60 !!!dummyNode ? process.env.NODE_ENV !== "production" ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : void 0;61 if (!markupWrap.hasOwnProperty(nodeName)) {62 nodeName = '*';63 }64 if (!shouldWrap.hasOwnProperty(nodeName)) {65 if (nodeName === '*') {66 dummyNode.innerHTML = '<link />';67 } else {68 dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';69 }70 shouldWrap[nodeName] = !dummyNode.firstChild;71 }72 return shouldWrap[nodeName] ? markupWrap[nodeName] : null;73}...
htmldomparser.js
Source:htmldomparser.js
1/*2 * HTMLParser - This implementation of parser assumes we are parsing HTML in browser3 * and user DOM methods available in browser for parsing HTML.4 * 5 * @author Himanshu Gilani6 * 7 */8var HTMLParser = function(node, handler, opts) {9 opts = opts || {};10 var nodesToIgnore = opts['nodesToIgnore'] || [];11 var parseHiddenNodes = opts['parseHiddenNodes'] || 'false';12 13 var c = node.childNodes;14 for ( var i = 0; i < c.length; i++) {15 try {16 var ignore = false;17 for(var k=0; k< nodesToIgnore.length; k++) {18 if(c[i].nodeName.toLowerCase() == nodesToIgnore[k]) {19 ignore= true;20 break;21 }22 }23 24 //NOTE hidden node testing is expensive in FF.25 if (ignore || (!parseHiddenNodes && isHiddenNode(c[i])) ){26 continue;27 } 28 29 if (c[i].nodeName.toLowerCase() != "#text" && c[i].nodeName.toLowerCase() != "#comment") {30 var attrs = [];31 if (c[i].hasAttributes()) {32 var attributes = c[i].attributes;33 for ( var a = 0; a < attributes.length; a++) {34 var attribute = attributes.item(a);35 attrs.push({36 name : attribute.nodeName,37 value : attribute.nodeValue,38 });39 }40 }41 if (handler.start) {42 if (c[i].hasChildNodes()) {43 handler.start(c[i].nodeName, attrs, false);44 if (c[i].nodeName.toLowerCase() == "pre" || c[i].nodeName.toLowerCase() == "code") {45 handler.chars(c[i].innerHTML);46 } else if (c[i].nodeName.toLowerCase() == "iframe" || c[i].nodeName.toLowerCase() == "frame") {47 if (c[i].contentDocument && c[i].contentDocument.documentElement) {48 return HTMLParser(c[i].contentDocument.documentElement, handler, opts);49 }50 } else if (c[i].hasChildNodes()) {51 HTMLParser(c[i], handler, opts);52 }53 if (handler.end) {54 handler.end(c[i].nodeName);55 }56 } else {57 handler.start(c[i].nodeName, attrs, true);58 }59 }60 } else if (c[i].nodeName.toLowerCase() == "#text") {61 if (handler.chars) {62 handler.chars(c[i].nodeValue);63 }64 } else if (c[i].nodeName.toLowerCase() == "#comment") {65 if (handler.comment) {66 handler.comment(c[i].nodeValue);67 }68 }69 } catch (e) {70 //properly log error 71 console.log("error while parsing node: " + c[i].nodeName.toLowerCase());72 }73 }74};75function isHiddenNode(node) {76 if(node.nodeName.toLowerCase() == "title"){77 return false;78 }79 80 if (window.getComputedStyle) {81 try {82 var style = window.getComputedStyle(node, null);83 if (style.getPropertyValue && style.getPropertyValue('display') == 'none') {84 return true;85 }86 } catch (e) {87 // consume and ignore. node styles are not accessible88 }89 return false;90 }...
Using AI Code Generation
1var istanbul = require('istanbul');2var instrumenter = new istanbul.Instrumenter();3var fs = require('fs');4var code = fs.readFileSync('test.js', 'utf8');5var instrumentedCode = instrumenter.instrumentSync(code, 'test.js');6console.log(instrumentedCode);7var esprima = require('esprima');8var escodegen = require('escodegen');9var esprimaOptions = {loc: true, range: true, comment: true};10var ast = esprima.parse(instrumentedCode, esprimaOptions);11function nodeName(node) {12 if (node.type === 'Identifier') {13 return node.name;14 } else if (node.type === 'Literal') {15 return node.value;16 } else if (node.type === 'MemberExpression') {17 return nodeName(node.object) + '.' + nodeName(node.property);18 } else if (node.type === 'ThisExpression') {19 return 'this';20 } else if (node.type === 'UnaryExpression' && node.operator === 'typeof') {21 return 'typeof ' + nodeName(node.argument);22 } else if (node.type === 'BinaryExpression' && node.operator === 'in') {23 return nodeName(node.left) + ' in ' + nodeName(node.right);24 } else if (node.type === 'CallExpression') {25 return nodeName(node.callee) + '()';26 } else if (node.type === 'NewExpression') {27 return 'new ' + nodeName(node.callee);28 } else if (node.type === 'VariableDeclarator') {29 return nodeName(node.id);30 } else if (node.type === 'AssignmentExpression') {31 return nodeName(node.left) + ' = ' + nodeName(node.right);32 } else if (node.type === 'ArrayExpression') {33 return '[' + node.elements.map(nodeName).join(', ') + ']';34 } else if (node.type === 'ObjectExpression') {35 return '{' + node.properties.map(function (prop) {36 return nodeName(prop.key) + ': ' + nodeName(prop.value);37 }).join(', ') + '}';38 } else if (node.type === 'Property') {39 return nodeName(node.value);40 } else if (node.type === 'FunctionExpression') {41 return 'function';42 } else if (node.type === 'FunctionDeclaration') {
Using AI Code Generation
1var istanbul = require('istanbul');2var collector = new istanbul.Collector();3var reporter = new istanbul.Reporter();4var reportType = 'text';5var reportType = 'text-summary';6var reportType = 'html';7var reportType = 'json';8var reportType = 'lcov';9var reportType = 'cobertura';10var reportType = 'teamcity';11var reportType = 'clover';12var reportType = 'json-summary';13var reportType = 'none';14var reportType = 'teamcity';15var reportType = 'text-lcov';16var reportType = 'text-summary';
Using AI Code Generation
1const istanbulLibInstrument = require('istanbul-lib-instrument');2const esprima = require('esprima');3const fs = require('fs');4const path = require('path');5const escodegen = require('escodegen');6const code = fs.readFileSync(path.join(__dirname, 'test.js'), 'utf8');7const ast = esprima.parse(code);8const instrumentedAST = istanbulLibInstrument.instrumenter().instrumentAST(ast, 'test.js');9const instrumentedCode = escodegen.generate(instrumentedAST);10console.log(instrumentedCode);
Using AI Code Generation
1const istanbul = require('istanbul-lib-coverage');2const map = istanbul.createCoverageMap();3const fs = require('fs');4const path = require('path');5const coverage = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'coverage.json'), 'utf8'));6map.merge(coverage);7console.log(map.data);8map.files().forEach(function (f) {9 var fc = map.fileCoverageFor(f);10 console.log('file', f);11 console.log(fc.toSummary());12 fc.data.path.forEach(function (p) {13 console.log('path', p);14 });15});16{17 "C:\\Users\\user\\Desktop\\test\\test.js": {18 {19 {20 "start": {21 },22 "end": {23 }24 }25 },26 {27 {28 "start": {29 },30 "end": {31 }32 }33 },34 {35 {36 "start": {37 },38 "end": {39 }40 }41 },42 {43 {44 "start": {45 },46 "end": {47 }48 }49 },50 {51 {52 "start": {53 },54 "end": {
Using AI Code Generation
1var istanbulLibInstrument = require('istanbul-lib-instrument');2var instrumenter = istanbulLibInstrument.createInstrumenter();3var code = 'function test() { console.log("test"); }';4var instrumentedCode = instrumenter.instrumentSync(code, 'test.js');5var istanbulLibInstrument = require('istanbul-lib-instrument');6var instrumenter = istanbulLibInstrument.createInstrumenter();7var code = 'function test() { console.log("test"); }';8var instrumentedCode = instrumenter.transform(code, 'test.js');9var istanbulLibInstrument = require('istanbul-lib-instrument');10var instrumenter = istanbulLibInstrument.createInstrumenter();11var code = 'function test() { console.log("test"); }';12var instrumentedCode = instrumenter.instrument(code, 'test.js');13var istanbulLibInstrument = require('istanbul-lib-instrument');14var instrumenter = istanbulLibInstrument.createInstrumenter();15var code = 'function test() { console.log("test"); }';16var instrumentedCode = instrumenter.transformSync(code, 'test.js');17var istanbulLibInstrument = require('istanbul-lib-instrument');18var instrumenter = istanbulLibInstrument.createInstrumenter();19var code = 'function test() { console.log("test"); }';20var instrumentedCode = instrumenter.instrumentSync(code, 'test.js');21var istanbulLibInstrument = require('istanbul-lib-instrument');22var instrumenter = istanbulLibInstrument.createInstrumenter();23var code = 'function test() { console.log("test"); }';24var instrumentedCode = instrumenter.instrumentSync(code, 'test.js');25var istanbulLibInstrument = require('istanbul-lib-instrument');26var instrumenter = istanbulLibInstrument.createInstrumenter();27var code = 'function test() { console.log("test"); }';28var instrumentedCode = instrumenter.instrumentSync(code, 'test.js');
Using AI Code Generation
1var istanbul = require('istanbul-lib-instrument');2var instrumenter = istanbul.createInstrumenter();3var code = "function hello(){return 'hello';}";4var instrumentedCode = instrumenter.instrumentSync(code, 'test.js');5console.log(instrumentedCode);6var istanbul = require('istanbul-lib-instrument');7var instrumenter = istanbul.createInstrumenter();8var code = "function hello(){return 'hello';}";9var instrumentedCode = instrumenter.instrumentSync(code, 'test.js');10console.log(instrumentedCode);
Using AI Code Generation
1var istanbul = require('istanbul');2var instrumenter = new istanbul.Instrumenter();3var fs = require('fs');4var code = fs.readFileSync('test.js', 'utf8');5var instrumentedCode = instrumenter.instrumentSync(code, 'test.js');6fs.writeFileSync('test-istanbul.js', instrumentedCode);7require('./test-istanbul.js');8var collector = new istanbul.Collector();9collector.add(global.__coverage__);10var reporter = new istanbul.Reporter();11reporter.add('text');12reporter.addAll(['html', 'lcov']);13reporter.write(collector, true, function () {14 console.log('All reports generated');15});16(function (exports, require, module, __filename, __dirname) { var istanbul = require('istanbul');
Using AI Code Generation
1var istanbul = require('istanbul-api');2var istanbul = istanbul.createReporter();3istanbul.add('text');4istanbul.write(istanbul.COVERAGE_VARIABLE);5var istanbul = require('istanbul-lib-report');6var istanbul = istanbul.createReporter();7istanbul.add('text');8istanbul.write(istanbul.COVERAGE_VARIABLE);
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!!