How to use named method in Jest

Best JavaScript code snippet using jest

readiness.js

Source:readiness.js Github

copy

Full Screen

1const fs = require('fs')2const argv = require('minimist')(process.argv.slice(2))3const path = require('path')4const cities = require('./worldcities.json')5const basePath = 'readiness'6const turf = require('turf')7var citiesArr = []8if (argv.mode === 'setup') {9 cities.features.forEach(function (feature) {10 // console.log(feature.geometry.coordinates);11 var tempFile = fs.createWriteStream(feature.properties.label + '.geojson')12 tempFile.on('open', function () {13 tempFile.write(JSON.stringify(feature))14 tempFile.end()15 })16 citiesArr.push(feature)17 })18 var citiesArrFile = fs.createWriteStream('citiesArr.json')19 citiesArrFile.on('open', function () {20 citiesArrFile.write(JSON.stringify(citiesArr))21 citiesArrFile.end()22 })23} else if (argv.mode === 'aggregate') {24 var boundaryCoverage = {'type': 'FeatureCollection', 'features': []}25 function getFolders (srcpath) {26 return fs.readdirSync(srcpath).filter(function (file) {27 return fs.statSync(path.join(srcpath, file)).isDirectory()28 })29 }30 var projFolders = getFolders(basePath)31 console.log('boundary' + ',' +32 'buildings' + ',' +33 '3D_buildings' + ',' +34 'exit' + ',' +35 'destination' + ',' +36 'restriction' + ',' +37 'turn_lanes' + ',' +38 'oneway' + ',' +39 'l_oneway' + ',' +40 'motorable_length' + ',' +41 'nonmotorable_length' + ',' +42 'motorable_name' + ',' +43 'named_highway' + ',' +44 'l_named_highway' + ',' +45 'motorway' + ',' +46 'l_motorway' + ',' +47 'named_motorway' + ',' +48 'motorway_link' + ',' +49 'l_motorway_link' + ',' +50 'named_motorway_link' + ',' +51 'trunk' + ',' +52 'l_trunk' + ',' +53 'named_trunk' + ',' +54 'trunk_link' + ',' +55 'l_trunk_link' + ',' +56 'named_trunk_link' + ',' +57 'primary' + ',' +58 'l_primary' + ',' +59 'named_primary' + ',' +60 'primary_link' + ',' +61 'l_primary_link' + ',' +62 'named_primary_link' + ',' +63 'secondary' + ',' +64 'l_secondary' + ',' +65 'named_secondary' + ',' +66 'secondary_link' + ',' +67 'l_secondary_link' + ',' +68 'named_secondary_link' + ',' +69 'tertiary' + ',' +70 'l_tertiary' + ',' +71 'named_tertiary' + ',' +72 'tertiary_link' + ',' +73 'l_tertiary_link' + ',' +74 'named_tertiary_link' + ',' +75 'residential' + ',' +76 'l_residential' + ',' +77 'named_residential' + ',' +78 'unclassified' + ',' +79 'l_unclassified' + ',' +80 'named_unclassified' + ',' +81 'service' + ',' +82 'l_service' + ',' +83 'named_service' + ',' +84 'living_street' + ',' +85 'l_living_street' + ',' +86 'named_living_street' + ',' +87 'footway' + ',' +88 'l_footway' + ',' +89 'named_footway' + ',' +90 'track' + ',' +91 'l_track' + ',' +92 'named_track' + ',' +93 'path' + ',' +94 'l_path' + ',' +95 'named_path' + ',' +96 'wikidata' + ',' +97 'city' + ',' +98 'town' + ',' +99 'neighbourhood' + ',' +100 'hamlet' + ',' +101 'suburb' + ',' +102 'village' + ',' +103 'poi' + ',' +104 'waterway' + ',' +105 'named_waterway' + ',' +106 'park' + ',' +107 'named_park'108 )109 projFolders.forEach(function (projFolder) {110 var feature = {}111 feature.boundary = projFolder112 cities.features.forEach(function (item) {113 if (item.properties.label === projFolder) {114 feature.area = turf.area(item) / 1000000115 }116 })117 if (projFolder !== 'node_modules') {118 var stats = fs.statSync('./' + basePath + '/' + projFolder + '/' + projFolder + '_basemap.json')119 var basemapFileSizeInBytes = stats['size']120 var stats = fs.statSync('./' + basePath + '/' + projFolder + '/' + projFolder + '_basemap.json')121 var poiFileSizeInBytes = stats['size']122 if (basemapFileSizeInBytes !== 0 && poiFileSizeInBytes != 0) {123 var baseMapData = require('./' + basePath + '/' + projFolder + '/' + projFolder + '_basemap.json')124 var poiData = require('./' + basePath + '/' + projFolder + '/' + projFolder + '_poi.json')125 var poiList = ['transport', 'amenities', 'shopping', 'leisure', 'infrastructure',126 'tourism', 'namedBuildings', 'natural', 'landuse']127 var poiCount = 0128 poiList.forEach(function (item) {129 if (poiData.hasOwnProperty(item)) {130 poiCount = poiCount + poiData[item]131 }132 })133 feature['buildings coverage'] = baseMapData.buildings / feature.area134 feature['trunk to motorway coverage'] = (baseMapData['l_trunk'] + baseMapData['l_trunk_link'] + baseMapData['l_motorway'] + baseMapData['l_motorway_link']) / feature.area135 feature['tertiary to primary road coverage'] = (baseMapData['l_primary'] + baseMapData['l_primary_link'] +136 baseMapData['l_secondary'] + baseMapData['l_secondary_link'] +137 baseMapData['l_tertiary'] + baseMapData['l_tertiary_link']) / feature.area138 feature['residential road coverage'] = baseMapData['l_residential'] / feature.area139 feature['cities + town names'] = (baseMapData['city'] + baseMapData['town']) / feature.area140 feature['village + hamlet + neighborhoods'] = (baseMapData['village'] + baseMapData['suburb'] + baseMapData['neighbourhood'] + baseMapData['hamlet']) / feature.area141 feature['waterway coverage'] = baseMapData['waterway'] / feature.area142 feature['park'] = baseMapData['park'] / feature.area143 feature['POI density'] = poiCount / feature.area144 feature['motorable_length'] = baseMapData['motorable_length']145 feature['percent_named_major'] = (baseMapData['named_motorway'] + baseMapData['named_motorway_link'] +146 baseMapData['named_trunk'] + baseMapData['named_trunk_link'] +147 baseMapData['named_primary'] + baseMapData['named_primary_link'] +148 baseMapData['named_secondary'] + baseMapData['named_secondary_link'] +149 baseMapData['named_tertiary'] + baseMapData['named_tertiary_link']) /150 (baseMapData['l_motorway'] + baseMapData['l_motorway_link'] +151 baseMapData['l_trunk'] + baseMapData['l_trunk_link'] +152 baseMapData['l_primary'] + baseMapData['l_primary_link'] +153 baseMapData['l_secondary'] + baseMapData['l_secondary_link'] +154 baseMapData['l_tertiary'] + baseMapData['l_tertiary_link'])155 feature['percent_oneway_major'] = (baseMapData['oneway_motorway'] + baseMapData['oneway_motorway_link'] +156 baseMapData['oneway_trunk'] + baseMapData['oneway_trunk_link'] +157 baseMapData['oneway_primary'] + baseMapData['oneway_primary_link'] +158 baseMapData['oneway_secondary'] + baseMapData['oneway_secondary_link'] +159 baseMapData['oneway_tertiary'] + baseMapData['oneway_tertiary_link']) /160 (baseMapData['l_motorway'] + baseMapData['l_motorway_link'] +161 baseMapData['l_trunk'] + baseMapData['l_trunk_link'] +162 baseMapData['l_primary'] + baseMapData['l_primary_link'] +163 baseMapData['l_secondary'] + baseMapData['l_secondary_link'] +164 baseMapData['l_tertiary'] + baseMapData['l_tertiary_link'])165 feature['percent_named_motorable'] = (baseMapData['named_motorway'] + baseMapData['named_motorway_link'] +166 baseMapData['named_trunk'] + baseMapData['named_trunk_link'] +167 baseMapData['named_primary'] + baseMapData['named_primary_link'] +168 baseMapData['named_secondary'] + baseMapData['named_secondary_link'] +169 baseMapData['named_tertiary'] + baseMapData['named_tertiary_link'] +170 baseMapData['named_residential'] +171 baseMapData['named_unclassified'] +172 baseMapData['named_service']) / baseMapData['motorable_length']173 feature['percent_oneway_motorable'] = (baseMapData['oneway_motorway'] + baseMapData['oneway_motorway_link'] +174 baseMapData['oneway_trunk'] + baseMapData['oneway_trunk_link'] +175 baseMapData['oneway_primary'] + baseMapData['oneway_primary_link'] +176 baseMapData['oneway_secondary'] + baseMapData['oneway_secondary_link'] +177 baseMapData['oneway_tertiary'] + baseMapData['oneway_tertiary_link'] +178 baseMapData['oneway_residential'] +179 baseMapData['oneway_unclassified'] +180 baseMapData['oneway_service']) / baseMapData['motorable_length']181 feature['percent_oneway_motorway'] = (baseMapData['oneway_motorway'] + baseMapData['oneway_motorway_link']) / (baseMapData['l_motorway'] + baseMapData['l_motorway_link'])182 feature['percent_named_motorway'] = (baseMapData['named_motorway'] + baseMapData['named_motorway_link']) / (baseMapData['l_motorway'] + baseMapData['l_motorway_link'])183 feature['percent_oneway_trunk'] = (baseMapData['oneway_trunk'] + baseMapData['oneway_trunk_link']) / (baseMapData['l_trunk'] + baseMapData['l_trunk_link'])184 feature['percent_named_trunk'] = (baseMapData['named_trunk'] + baseMapData['named_trunk_link']) / (baseMapData['l_trunk'] + baseMapData['l_trunk_link'])185 feature['percent_oneway_primary'] = (baseMapData['oneway_primary'] + baseMapData['oneway_primary_link']) / (baseMapData['l_primary'] + baseMapData['l_primary_link'])186 feature['percent_named_primary'] = (baseMapData['named_primary'] + baseMapData['named_primary_link']) / (baseMapData['l_primary'] + baseMapData['l_primary_link'])187 feature['percent_oneway_secondary'] = (baseMapData['oneway_secondary'] + baseMapData['oneway_secondary_link']) / (baseMapData['l_secondary'] + baseMapData['l_secondary_link'])188 feature['percent_named_secondary'] = (baseMapData['named_secondary'] + baseMapData['named_secondary_link']) / (baseMapData['l_secondary'] + baseMapData['l_secondary_link'])189 feature['percent_oneway_tertiary'] = (baseMapData['oneway_tertiary'] + baseMapData['oneway_tertiary_link']) / (baseMapData['l_tertiary'] + baseMapData['l_tertiary_link'])190 feature['percent_named_tertiary'] = (baseMapData['named_tertiary'] + baseMapData['named_tertiary_link']) / (baseMapData['l_tertiary'] + baseMapData['l_tertiary_link'])191 feature['TR coverage'] = baseMapData['restriction'] / feature['motorable_length']192 feature['TL coverage'] = baseMapData['turn_lanes'] / feature['motorable_length']193 feature['exit + destination coverage'] = (baseMapData.exit + baseMapData.destination) / feature['motorable_length']194 boundaryCoverage.features.push(feature)195 console.log(projFolder + ',' +196 baseMapData.buildings + ',' +197 baseMapData['3D_buildings'] + ',' +198 baseMapData.exit + ',' +199 baseMapData.destination + ',' +200 baseMapData.restriction + ',' +201 baseMapData['turn_lanes'] + ',' +202 baseMapData['oneway'] + ',' +203 baseMapData['l_oneway'] + ',' +204 baseMapData['motorable_length'] + ',' +205 baseMapData['nonmotorable_length'] + ',' +206 baseMapData['motorable_name'] + ',' +207 baseMapData['named_highway'] + ',' +208 baseMapData['l_named_highway'] + ',' +209 baseMapData['motorway'] + ',' +210 baseMapData['l_motorway'] + ',' +211 baseMapData['named_motorway'] + ',' +212 baseMapData['motorway_link'] + ',' +213 baseMapData['l_motorway_link'] + ',' +214 baseMapData['named_motorway_link'] + ',' +215 baseMapData['trunk'] + ',' +216 baseMapData['l_trunk'] + ',' +217 baseMapData['named_trunk'] + ',' +218 baseMapData['trunk_link'] + ',' +219 baseMapData['l_trunk_link'] + ',' +220 baseMapData['named_trunk_link'] + ',' +221 baseMapData['primary'] + ',' +222 baseMapData['l_primary'] + ',' +223 baseMapData['named_primary'] + ',' +224 baseMapData['primary_link'] + ',' +225 baseMapData['l_primary_link'] + ',' +226 baseMapData['named_primary_link'] + ',' +227 baseMapData['secondary'] + ',' +228 baseMapData['l_secondary'] + ',' +229 baseMapData['named_secondary'] + ',' +230 baseMapData['secondary_link'] + ',' +231 baseMapData['l_secondary_link'] + ',' +232 baseMapData['named_secondary_link'] + ',' +233 baseMapData['tertiary'] + ',' +234 baseMapData['l_tertiary'] + ',' +235 baseMapData['named_tertiary'] + ',' +236 baseMapData['tertiary_link'] + ',' +237 baseMapData['l_tertiary_link'] + ',' +238 baseMapData['named_tertiary_link'] + ',' +239 baseMapData['residential'] + ',' +240 baseMapData['l_residential'] + ',' +241 baseMapData['named_residential'] + ',' +242 baseMapData['unclassified'] + ',' +243 baseMapData['l_unclassified'] + ',' +244 baseMapData['named_unclassified'] + ',' +245 baseMapData['service'] + ',' +246 baseMapData['l_service'] + ',' +247 baseMapData['named_service'] + ',' +248 baseMapData['living_street'] + ',' +249 baseMapData['l_living_street'] + ',' +250 baseMapData['named_living_street'] + ',' +251 baseMapData['footway'] + ',' +252 baseMapData['l_footway'] + ',' +253 baseMapData['named_footway'] + ',' +254 baseMapData['track'] + ',' +255 baseMapData['l_track'] + ',' +256 baseMapData['named_track'] + ',' +257 baseMapData['path'] + ',' +258 baseMapData['l_path'] + ',' +259 baseMapData['named_path'] + ',' +260 baseMapData['wikidata'] + ',' +261 baseMapData['city'] + ',' +262 baseMapData['town'] + ',' +263 baseMapData['neighbourhood'] + ',' +264 baseMapData['hamlet'] + ',' +265 baseMapData['suburb'] + ',' +266 baseMapData['village'] + ',' +267 poiCount + ',' +268 baseMapData['waterway'] + ',' +269 baseMapData['named_waterway'] + ',' +270 baseMapData['park'] + ',' +271 baseMapData['named_park']272 )273 }274 }275 })276 fs.writeFile('coverage.json', JSON.stringify(boundaryCoverage), (err) => {277 if (err) throw err278 // console.log('It\'s saved!');279 })280 var coverageCSV = ''281 var properties = Object.keys(boundaryCoverage.features[0])282 properties.forEach(function (item, index) {283 if (index !== [properties.length] - 1) {284 coverageCSV += item + ','285 } else {286 coverageCSV += item287 }288 })289 coverageCSV += '\n'290 boundaryCoverage.features.forEach(function (item) {291 var properties = Object.keys(item)292 properties.forEach(function (property, index) {293 if (index !== [properties.length] - 1) {294 coverageCSV += item[property] + ','295 } else {296 coverageCSV += item[property]297 }298 })299 coverageCSV += '\n'300 })301 fs.writeFile('coverage.csv', coverageCSV, (err) => {302 if (err) throw err303 // console.log('It\'s saved!');304 })305} else if (argv.mode === 'baseline') {306 var baseline = {'type': 'FeatureCollection', 'features': []}307 var north_america_highways = ['NewYork_exterior_NY', 'Washington_exterior_DC', 'SFCity_exterior_CA', 'Los_Angeles_exterior_CA']308 var north_america_buildings = ['NewYork_exterior_NY', 'Washington_core_DC', 'SFCity_exterior_CA', 'Boston_exterior_MA']309 var north_america_tr = ['Montreal_CA', 'Ottawa_CA', 'SFCity_exterior_CA']310 var north_america_tl = ['Oklahoma_exterior_OK', 'San_Diego_exterior_CA', 'SFbay_exterior_CA']311 var north_america_exit = ['NewYork_exterior_NY', 'Washington_exterior_DC', 'SFCity_exterior_CA', 'Los_Angeles_exterior_CA']312 var europe_highways = ['Berlin_GE', 'London', 'Paris_exterior', 'Munich_GE']313 var europe_buildings = ['Berlin_GE', 'London', 'Paris_exterior', 'Munich_GE']314 var europe_tr = ['Berlin_GE', 'London', 'Paris_exterior', 'Munich_GE']315 var europe_tl = ['Berlin_GE', 'London', 'Paris_exterior', 'Munich_GE']316 var europe_exit = ['Berlin_GE', 'London', 'Paris_exterior', 'Munich_GE']317 var asia_highways = ['Manila_exterior', 'KualaLumpur_exterior', 'Bangkok_exterior', 'Singapore_exterior', 'Jakarta_exterior']318 var asia_buildings = ['Manila_exterior', 'KualaLumpur_exterior', 'Singapore_exterior']319 var asia_tr = ['Manila_exterior', 'KualaLumpur_exterior', 'Bangkok_exterior', 'Singapore_exterior', 'Jakarta_exterior']320 var asia_tl = ['Manila_exterior', 'KualaLumpur_exterior', 'Bangkok_exterior', 'Singapore_exterior', 'Jakarta_exterior']321 var asia_exit = ['Manila_exterior', 'KualaLumpur_exterior', 'Bangkok_exterior', 'Singapore_exterior', 'Jakarta_exterior']322 var baselineFeature = {}323} else if (argv.mode === 'coverage') {...

Full Screen

Full Screen

CSSNamedFlowCollectionsView.js

Source:CSSNamedFlowCollectionsView.js Github

copy

Full Screen

1/*2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.3 *4 * Redistribution and use in source and binary forms, with or without5 * modification, are permitted provided that the following conditions6 * are met:7 *8 * 1. Redistributions of source code must retain the above9 * copyright notice, this list of conditions and the following10 * disclaimer.11 * 2. Redistributions in binary form must reproduce the above12 * copyright notice, this list of conditions and the following13 * disclaimer in the documentation and/or other materials14 * provided with the distribution.15 *16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE20 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED27 * OF THE POSSIBILITY OF SUCH DAMAGE.28 */29/**30 * @constructor31 * @extends {WebInspector.SidebarView}32 */33WebInspector.CSSNamedFlowCollectionsView = function()34{35 WebInspector.SidebarView.call(this, WebInspector.SidebarView.SidebarPosition.Start);36 this.registerRequiredCSS("cssNamedFlows.css");37 this._namedFlows = {};38 this._contentNodes = {};39 this._regionNodes = {};40 this.element.addStyleClass("css-named-flow-collections-view");41 this.element.addStyleClass("fill");42 this._statusElement = document.createElement("span");43 this._statusElement.textContent = WebInspector.UIString("CSS Named Flows");44 var sidebarHeader = this.firstElement().createChild("div", "tabbed-pane-header selected sidebar-header");45 var tab = sidebarHeader.createChild("div", "tabbed-pane-header-tab");46 tab.createChild("span", "tabbed-pane-header-tab-title").textContent = WebInspector.UIString("CSS Named Flows");47 this._sidebarContentElement = this.firstElement().createChild("div", "sidebar-content outline-disclosure");48 this._flowListElement = this._sidebarContentElement.createChild("ol");49 this._flowTree = new TreeOutline(this._flowListElement);50 this._emptyElement = document.createElement("div");51 this._emptyElement.addStyleClass("info");52 this._emptyElement.textContent = WebInspector.UIString("No CSS Named Flows");53 this._tabbedPane = new WebInspector.TabbedPane();54 this._tabbedPane.closeableTabs = true;55 this._tabbedPane.show(this.secondElement());56}57WebInspector.CSSNamedFlowCollectionsView.prototype = {58 showInDrawer: function()59 {60 WebInspector.showViewInDrawer(this._statusElement, this);61 },62 reset: function()63 {64 if (!this._document)65 return;66 WebInspector.cssModel.getNamedFlowCollectionAsync(this._document.id, this._resetNamedFlows.bind(this));67 },68 /**69 * @param {WebInspector.DOMDocument} document70 */71 _setDocument: function(document)72 {73 this._document = document;74 this.reset();75 },76 /**77 * @param {WebInspector.Event} event78 */79 _documentUpdated: function(event)80 {81 var document = /** @type {WebInspector.DOMDocument} */ (event.data);82 this._setDocument(document);83 },84 /**85 * @param {boolean} hasContent86 */87 _setSidebarHasContent: function(hasContent)88 {89 if (hasContent) {90 if (!this._emptyElement.parentNode)91 return;92 this._sidebarContentElement.removeChild(this._emptyElement);93 this._sidebarContentElement.appendChild(this._flowListElement);94 } else {95 if (!this._flowListElement.parentNode)96 return;97 this._sidebarContentElement.removeChild(this._flowListElement);98 this._sidebarContentElement.appendChild(this._emptyElement);99 }100 },101 /**102 * @param {WebInspector.NamedFlow} flow103 */104 _appendNamedFlow: function(flow)105 {106 var flowHash = this._hashNamedFlow(flow.documentNodeId, flow.name);107 var flowContainer = { flow: flow, flowHash: flowHash };108 for (var i = 0; i < flow.content.length; ++i)109 this._contentNodes[flow.content[i]] = flowHash;110 for (var i = 0; i < flow.regions.length; ++i)111 this._regionNodes[flow.regions[i].nodeId] = flowHash;112 var flowTreeItem = new WebInspector.FlowTreeElement(flowContainer);113 flowTreeItem.onselect = this._selectNamedFlowTab.bind(this, flowHash);114 flowContainer.flowTreeItem = flowTreeItem;115 this._namedFlows[flowHash] = flowContainer;116 if (!this._flowTree.children.length)117 this._setSidebarHasContent(true);118 this._flowTree.appendChild(flowTreeItem);119 },120 /**121 * @param {string} flowHash122 */123 _removeNamedFlow: function(flowHash)124 {125 var flowContainer = this._namedFlows[flowHash];126 if (this._tabbedPane._tabsById[flowHash])127 this._tabbedPane.closeTab(flowHash);128 this._flowTree.removeChild(flowContainer.flowTreeItem);129 var flow = flowContainer.flow;130 for (var i = 0; i < flow.content.length; ++i)131 delete this._contentNodes[flow.content[i]];132 for (var i = 0; i < flow.regions.length; ++i)133 delete this._regionNodes[flow.regions[i].nodeId];134 delete this._namedFlows[flowHash];135 if (!this._flowTree.children.length)136 this._setSidebarHasContent(false);137 },138 /**139 * @param {WebInspector.NamedFlow} flow140 */141 _updateNamedFlow: function(flow)142 {143 var flowHash = this._hashNamedFlow(flow.documentNodeId, flow.name);144 var flowContainer = this._namedFlows[flowHash];145 if (!flowContainer)146 return;147 var oldFlow = flowContainer.flow;148 flowContainer.flow = flow;149 for (var i = 0; i < oldFlow.content.length; ++i)150 delete this._contentNodes[oldFlow.content[i]];151 for (var i = 0; i < oldFlow.regions.length; ++i)152 delete this._regionNodes[oldFlow.regions[i].nodeId];153 for (var i = 0; i < flow.content.length; ++i)154 this._contentNodes[flow.content[i]] = flowHash;155 for (var i = 0; i < flow.regions.length; ++i)156 this._regionNodes[flow.regions[i].nodeId] = flowHash;157 flowContainer.flowTreeItem.setOverset(flow.overset);158 if (flowContainer.flowView)159 flowContainer.flowView.flow = flow;160 },161 /**162 * @param {WebInspector.NamedFlowCollection} namedFlowCollection163 */164 _resetNamedFlows: function(namedFlowCollection)165 {166 for (var flowHash in this._namedFlows)167 this._removeNamedFlow(flowHash);168 var namedFlows = namedFlowCollection.namedFlowMap;169 for (var flowName in namedFlows)170 this._appendNamedFlow(namedFlows[flowName]);171 if (!this._flowTree.children.length)172 this._setSidebarHasContent(false);173 else174 this._showNamedFlowForNode(WebInspector.panel("elements").treeOutline.selectedDOMNode());175 },176 /**177 * @param {WebInspector.Event} event178 */179 _namedFlowCreated: function(event)180 {181 // FIXME: We only have support for Named Flows in the main document.182 if (event.data.documentNodeId !== this._document.id)183 return;184 var flow = /** @type {WebInspector.NamedFlow} */ (event.data);185 this._appendNamedFlow(flow);186 },187 /**188 * @param {WebInspector.Event} event189 */190 _namedFlowRemoved: function(event)191 {192 // FIXME: We only have support for Named Flows in the main document.193 if (event.data.documentNodeId !== this._document.id)194 return;195 this._removeNamedFlow(this._hashNamedFlow(event.data.documentNodeId, event.data.flowName));196 },197 /**198 * @param {WebInspector.Event} event199 */200 _regionLayoutUpdated: function(event)201 {202 // FIXME: We only have support for Named Flows in the main document.203 if (event.data.documentNodeId !== this._document.id)204 return;205 var flow = /** @type {WebInspector.NamedFlow} */ (event.data);206 this._updateNamedFlow(flow);207 },208 /**209 * @param {WebInspector.Event} event210 */211 _regionOversetChanged: function(event)212 {213 // FIXME: We only have support for Named Flows in the main document.214 if (event.data.documentNodeId !== this._document.id)215 return;216 var flow = /** @type {WebInspector.NamedFlow} */ (event.data);217 this._updateNamedFlow(flow);218 },219 /**220 * @param {DOMAgent.NodeId} documentNodeId221 * @param {string} flowName222 */223 _hashNamedFlow: function(documentNodeId, flowName)224 {225 return documentNodeId + "|" + flowName;226 },227 /**228 * @param {string} flowHash229 */230 _showNamedFlow: function(flowHash)231 {232 this._selectNamedFlowInSidebar(flowHash);233 this._selectNamedFlowTab(flowHash);234 },235 /**236 * @param {string} flowHash237 */238 _selectNamedFlowInSidebar: function(flowHash)239 {240 this._namedFlows[flowHash].flowTreeItem.select(true);241 },242 /**243 * @param {string} flowHash244 */245 _selectNamedFlowTab: function(flowHash)246 {247 var flowContainer = this._namedFlows[flowHash];248 if (this._tabbedPane.selectedTabId === flowHash)249 return;250 if (!this._tabbedPane.selectTab(flowHash)) {251 if (!flowContainer.flowView)252 flowContainer.flowView = new WebInspector.CSSNamedFlowView(flowContainer.flow);253 this._tabbedPane.appendTab(flowHash, flowContainer.flow.name, flowContainer.flowView);254 this._tabbedPane.selectTab(flowHash);255 }256 },257 /**258 * @param {WebInspector.Event} event259 */260 _selectedNodeChanged: function(event)261 {262 var node = /** @type {WebInspector.DOMNode} */ (event.data);263 this._showNamedFlowForNode(node);264 },265 /**266 * @param {WebInspector.Event} event267 */268 _tabSelected: function(event)269 {270 this._selectNamedFlowInSidebar(event.data.tabId);271 },272 /**273 * @param {WebInspector.Event} event274 */275 _tabClosed: function(event)276 {277 this._namedFlows[event.data.tabId].flowTreeItem.deselect();278 },279 /**280 * @param {?WebInspector.DOMNode} node281 */282 _showNamedFlowForNode: function(node)283 {284 if (!node)285 return;286 if (this._regionNodes[node.id]) {287 this._showNamedFlow(this._regionNodes[node.id]);288 return;289 }290 while (node) {291 if (this._contentNodes[node.id]) {292 this._showNamedFlow(this._contentNodes[node.id]);293 return;294 }295 node = node.parentNode;296 }297 },298 wasShown: function()299 {300 WebInspector.SidebarView.prototype.wasShown.call(this);301 WebInspector.domAgent.requestDocument(this._setDocument.bind(this));302 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdated, this);303 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, this._namedFlowCreated, this);304 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, this._namedFlowRemoved, this);305 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, this._regionLayoutUpdated, this);306 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.RegionOversetChanged, this._regionOversetChanged, this);307 WebInspector.panel("elements").treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedNodeChanged, this);308 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._tabSelected, this);309 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabClosed, this._tabClosed, this);310 },311 willHide: function()312 {313 WebInspector.domAgent.removeEventListener(WebInspector.DOMAgent.Events.DocumentUpdated, this._documentUpdated, this);314 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowCreated, this._namedFlowCreated, this);315 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.NamedFlowRemoved, this._namedFlowRemoved, this);316 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.RegionLayoutUpdated, this._regionLayoutUpdated, this);317 WebInspector.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.RegionOversetChanged, this._regionOversetChanged, this);318 WebInspector.panel("elements").treeOutline.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedNodeChanged, this);319 this._tabbedPane.removeEventListener(WebInspector.TabbedPane.EventTypes.TabSelected, this._tabSelected, this);320 this._tabbedPane.removeEventListener(WebInspector.TabbedPane.EventTypes.TabClosed, this._tabClosed, this);321 },322 __proto__: WebInspector.SidebarView.prototype323}324/**325 * @constructor326 * @extends {TreeElement}327 */328WebInspector.FlowTreeElement = function(flowContainer)329{330 var container = document.createElement("div");331 container.createChild("div", "selection");332 container.createChild("span", "title").createChild("span").textContent = flowContainer.flow.name;333 TreeElement.call(this, container, flowContainer, false);334 this._overset = false;335 this.setOverset(flowContainer.flow.overset);336}337WebInspector.FlowTreeElement.prototype = {338 /**339 * @param {boolean} newOverset340 */341 setOverset: function(newOverset)342 {343 if (this._overset === newOverset)344 return;345 if (newOverset) {346 this.title.addStyleClass("named-flow-overflow");347 this.tooltip = WebInspector.UIString("Overflows.");348 } else {349 this.title.removeStyleClass("named-flow-overflow");350 this.tooltip = "";351 }352 this._overset = newOverset;353 },354 __proto__: TreeElement.prototype...

Full Screen

Full Screen

NamedNodeMap.js

Source:NamedNodeMap.js Github

copy

Full Screen

1"use strict";2const conversions = require("webidl-conversions");3const utils = require("./utils.js");4const convertAttr = require("./Attr.js").convert;5const impl = utils.implSymbol;6function NamedNodeMap() {7 throw new TypeError("Illegal constructor");8}9Object.defineProperty(NamedNodeMap, "prototype", {10 value: NamedNodeMap.prototype,11 writable: false,12 enumerable: false,13 configurable: false14});15Object.defineProperty(NamedNodeMap.prototype, Symbol.iterator, {16 writable: true,17 enumerable: false,18 configurable: true,19 value: Array.prototype[Symbol.iterator]20});21NamedNodeMap.prototype.item = function item(index) {22 if (!this || !module.exports.is(this)) {23 throw new TypeError("Illegal invocation");24 }25 if (arguments.length < 1) {26 throw new TypeError(27 "Failed to execute 'item' on 'NamedNodeMap': 1 argument required, but only " + arguments.length + " present."28 );29 }30 const args = [];31 {32 let curArg = arguments[0];33 curArg = conversions["unsigned long"](curArg, {34 context: "Failed to execute 'item' on 'NamedNodeMap': parameter 1"35 });36 args.push(curArg);37 }38 return utils.tryWrapperForImpl(this[impl].item(...args));39};40NamedNodeMap.prototype.getNamedItem = function getNamedItem(qualifiedName) {41 if (!this || !module.exports.is(this)) {42 throw new TypeError("Illegal invocation");43 }44 if (arguments.length < 1) {45 throw new TypeError(46 "Failed to execute 'getNamedItem' on 'NamedNodeMap': 1 argument required, but only " +47 arguments.length +48 " present."49 );50 }51 const args = [];52 {53 let curArg = arguments[0];54 curArg = conversions["DOMString"](curArg, {55 context: "Failed to execute 'getNamedItem' on 'NamedNodeMap': parameter 1"56 });57 args.push(curArg);58 }59 return utils.tryWrapperForImpl(this[impl].getNamedItem(...args));60};61NamedNodeMap.prototype.getNamedItemNS = function getNamedItemNS(namespace, localName) {62 if (!this || !module.exports.is(this)) {63 throw new TypeError("Illegal invocation");64 }65 if (arguments.length < 2) {66 throw new TypeError(67 "Failed to execute 'getNamedItemNS' on 'NamedNodeMap': 2 arguments required, but only " +68 arguments.length +69 " present."70 );71 }72 const args = [];73 {74 let curArg = arguments[0];75 if (curArg === null || curArg === undefined) {76 curArg = null;77 } else {78 curArg = conversions["DOMString"](curArg, {79 context: "Failed to execute 'getNamedItemNS' on 'NamedNodeMap': parameter 1"80 });81 }82 args.push(curArg);83 }84 {85 let curArg = arguments[1];86 curArg = conversions["DOMString"](curArg, {87 context: "Failed to execute 'getNamedItemNS' on 'NamedNodeMap': parameter 2"88 });89 args.push(curArg);90 }91 return utils.tryWrapperForImpl(this[impl].getNamedItemNS(...args));92};93NamedNodeMap.prototype.setNamedItem = function setNamedItem(attr) {94 if (!this || !module.exports.is(this)) {95 throw new TypeError("Illegal invocation");96 }97 if (arguments.length < 1) {98 throw new TypeError(99 "Failed to execute 'setNamedItem' on 'NamedNodeMap': 1 argument required, but only " +100 arguments.length +101 " present."102 );103 }104 const args = [];105 {106 let curArg = arguments[0];107 curArg = convertAttr(curArg, { context: "Failed to execute 'setNamedItem' on 'NamedNodeMap': parameter 1" });108 args.push(curArg);109 }110 return utils.tryWrapperForImpl(this[impl].setNamedItem(...args));111};112NamedNodeMap.prototype.setNamedItemNS = function setNamedItemNS(attr) {113 if (!this || !module.exports.is(this)) {114 throw new TypeError("Illegal invocation");115 }116 if (arguments.length < 1) {117 throw new TypeError(118 "Failed to execute 'setNamedItemNS' on 'NamedNodeMap': 1 argument required, but only " +119 arguments.length +120 " present."121 );122 }123 const args = [];124 {125 let curArg = arguments[0];126 curArg = convertAttr(curArg, { context: "Failed to execute 'setNamedItemNS' on 'NamedNodeMap': parameter 1" });127 args.push(curArg);128 }129 return utils.tryWrapperForImpl(this[impl].setNamedItemNS(...args));130};131NamedNodeMap.prototype.removeNamedItem = function removeNamedItem(qualifiedName) {132 if (!this || !module.exports.is(this)) {133 throw new TypeError("Illegal invocation");134 }135 if (arguments.length < 1) {136 throw new TypeError(137 "Failed to execute 'removeNamedItem' on 'NamedNodeMap': 1 argument required, but only " +138 arguments.length +139 " present."140 );141 }142 const args = [];143 {144 let curArg = arguments[0];145 curArg = conversions["DOMString"](curArg, {146 context: "Failed to execute 'removeNamedItem' on 'NamedNodeMap': parameter 1"147 });148 args.push(curArg);149 }150 return utils.tryWrapperForImpl(this[impl].removeNamedItem(...args));151};152NamedNodeMap.prototype.removeNamedItemNS = function removeNamedItemNS(namespace, localName) {153 if (!this || !module.exports.is(this)) {154 throw new TypeError("Illegal invocation");155 }156 if (arguments.length < 2) {157 throw new TypeError(158 "Failed to execute 'removeNamedItemNS' on 'NamedNodeMap': 2 arguments required, but only " +159 arguments.length +160 " present."161 );162 }163 const args = [];164 {165 let curArg = arguments[0];166 if (curArg === null || curArg === undefined) {167 curArg = null;168 } else {169 curArg = conversions["DOMString"](curArg, {170 context: "Failed to execute 'removeNamedItemNS' on 'NamedNodeMap': parameter 1"171 });172 }173 args.push(curArg);174 }175 {176 let curArg = arguments[1];177 curArg = conversions["DOMString"](curArg, {178 context: "Failed to execute 'removeNamedItemNS' on 'NamedNodeMap': parameter 2"179 });180 args.push(curArg);181 }182 return utils.tryWrapperForImpl(this[impl].removeNamedItemNS(...args));183};184Object.defineProperty(NamedNodeMap.prototype, "length", {185 get() {186 if (!this || !module.exports.is(this)) {187 throw new TypeError("Illegal invocation");188 }189 return this[impl]["length"];190 },191 enumerable: true,192 configurable: true193});194Object.defineProperty(NamedNodeMap.prototype, Symbol.toStringTag, {195 value: "NamedNodeMap",196 writable: false,197 enumerable: false,198 configurable: true199});200const iface = {201 // When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`202 // method into this array. It allows objects that directly implements *those* interfaces to be recognized as203 // implementing this mixin interface.204 _mixedIntoPredicates: [],205 is(obj) {206 if (obj) {207 if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {208 return true;209 }210 for (const isMixedInto of module.exports._mixedIntoPredicates) {211 if (isMixedInto(obj)) {212 return true;213 }214 }215 }216 return false;217 },218 isImpl(obj) {219 if (obj) {220 if (obj instanceof Impl.implementation) {221 return true;222 }223 const wrapper = utils.wrapperForImpl(obj);224 for (const isMixedInto of module.exports._mixedIntoPredicates) {225 if (isMixedInto(wrapper)) {226 return true;227 }228 }229 }230 return false;231 },232 convert(obj, { context = "The provided value" } = {}) {233 if (module.exports.is(obj)) {234 return utils.implForWrapper(obj);235 }236 throw new TypeError(`${context} is not of type 'NamedNodeMap'.`);237 },238 create(constructorArgs, privateData) {239 let obj = Object.create(NamedNodeMap.prototype);240 obj = this.setup(obj, constructorArgs, privateData);241 return obj;242 },243 createImpl(constructorArgs, privateData) {244 let obj = Object.create(NamedNodeMap.prototype);245 obj = this.setup(obj, constructorArgs, privateData);246 return utils.implForWrapper(obj);247 },248 _internalSetup(obj) {},249 setup(obj, constructorArgs, privateData) {250 if (!privateData) privateData = {};251 privateData.wrapper = obj;252 this._internalSetup(obj);253 Object.defineProperty(obj, impl, {254 value: new Impl.implementation(constructorArgs, privateData),255 writable: false,256 enumerable: false,257 configurable: true258 });259 obj = new Proxy(obj, {260 get(target, P, receiver) {261 if (typeof P === "symbol") {262 return Reflect.get(target, P, receiver);263 }264 const desc = this.getOwnPropertyDescriptor(target, P);265 if (desc === undefined) {266 const parent = Object.getPrototypeOf(target);267 if (parent === null) {268 return undefined;269 }270 return Reflect.get(target, P, receiver);271 }272 if (!desc.get && !desc.set) {273 return desc.value;274 }275 const getter = desc.get;276 if (getter === undefined) {277 return undefined;278 }279 return Reflect.apply(getter, receiver, []);280 },281 has(target, P) {282 if (typeof P === "symbol") {283 return Reflect.has(target, P);284 }285 const desc = this.getOwnPropertyDescriptor(target, P);286 if (desc !== undefined) {287 return true;288 }289 const parent = Object.getPrototypeOf(target);290 if (parent !== null) {291 return Reflect.has(parent, P);292 }293 return false;294 },295 ownKeys(target) {296 const keys = new Set();297 for (const key of target[impl][utils.supportedPropertyIndices]) {298 keys.add(`${key}`);299 }300 for (const key of target[impl][utils.supportedPropertyNames]) {301 if (!(key in target)) {302 keys.add(`${key}`);303 }304 }305 for (const key of Reflect.ownKeys(target)) {306 keys.add(key);307 }308 return [...keys];309 },310 getOwnPropertyDescriptor(target, P) {311 if (typeof P === "symbol") {312 return Reflect.getOwnPropertyDescriptor(target, P);313 }314 let ignoreNamedProps = false;315 if (utils.isArrayIndexPropName(P)) {316 const index = P >>> 0;317 const indexedValue = target[impl].item(index);318 if (indexedValue !== null) {319 return {320 writable: false,321 enumerable: true,322 configurable: true,323 value: utils.tryWrapperForImpl(indexedValue)324 };325 }326 ignoreNamedProps = true;327 }328 const namedValue = target[impl].getNamedItem(P);329 if (namedValue !== null && !(P in target) && !ignoreNamedProps) {330 return {331 writable: false,332 enumerable: false,333 configurable: true,334 value: utils.tryWrapperForImpl(namedValue)335 };336 }337 return Reflect.getOwnPropertyDescriptor(target, P);338 },339 set(target, P, V, receiver) {340 if (typeof P === "symbol") {341 return Reflect.set(target, P, V, receiver);342 }343 if (target === receiver) {344 utils.isArrayIndexPropName(P);345 typeof P === "string" && !utils.isArrayIndexPropName(P);346 }347 let ownDesc;348 if (utils.isArrayIndexPropName(P)) {349 const index = P >>> 0;350 const indexedValue = target[impl].item(index);351 if (indexedValue !== null) {352 ownDesc = {353 writable: false,354 enumerable: true,355 configurable: true,356 value: utils.tryWrapperForImpl(indexedValue)357 };358 }359 }360 if (ownDesc === undefined) {361 ownDesc = Reflect.getOwnPropertyDescriptor(target, P);362 }363 if (ownDesc === undefined) {364 const parent = Reflect.getPrototypeOf(target);365 if (parent !== null) {366 return Reflect.set(parent, P, V, receiver);367 }368 ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined };369 }370 if (!ownDesc.writable) {371 return false;372 }373 if (!utils.isObject(receiver)) {374 return false;375 }376 const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P);377 let valueDesc;378 if (existingDesc !== undefined) {379 if (existingDesc.get || existingDesc.set) {380 return false;381 }382 if (!existingDesc.writable) {383 return false;384 }385 valueDesc = { value: V };386 } else {387 valueDesc = { writable: true, enumerable: true, configurable: true, value: V };388 }389 return Reflect.defineProperty(receiver, P, valueDesc);390 },391 defineProperty(target, P, desc) {392 if (typeof P === "symbol") {393 return Reflect.defineProperty(target, P, desc);394 }395 if (utils.isArrayIndexPropName(P)) {396 return false;397 }398 if (!utils.hasOwn(target, P)) {399 const creating = !(target[impl].getNamedItem(P) !== null);400 if (!creating) {401 return false;402 }403 }404 return Reflect.defineProperty(target, P, desc);405 },406 deleteProperty(target, P) {407 if (typeof P === "symbol") {408 return Reflect.deleteProperty(target, P);409 }410 if (utils.isArrayIndexPropName(P)) {411 const index = P >>> 0;412 return !(target[impl].item(index) !== null);413 }414 if (target[impl].getNamedItem(P) !== null && !(P in target)) {415 return false;416 }417 return Reflect.deleteProperty(target, P);418 },419 preventExtensions() {420 return false;421 }422 });423 obj[impl][utils.wrapperSymbol] = obj;424 if (Impl.init) {425 Impl.init(obj[impl], privateData);426 }427 return obj;428 },429 interface: NamedNodeMap,430 expose: {431 Window: { NamedNodeMap }432 }433}; // iface434module.exports = iface;...

Full Screen

Full Screen

color.js

Source:color.js Github

copy

Full Screen

1// color class2function SpawColor()3{4}5SpawColor.prototype.hue = 359;6SpawColor.prototype.saturation = 100;7SpawColor.prototype.brightness = 100;8SpawColor.prototype.red = 255;9SpawColor.prototype.green = 255;10SpawColor.prototype.blue = 255;11SpawColor.prototype.setHSB = function(h, s, b)12{13 if (h != null)14 this.hue = h;15 if (s != null)16 this.saturation = s;17 if (b != null)18 this.brightness = b;19 this.updateRGBFromHSB();20}21SpawColor.prototype.setRGB = function(r, g, b)22{23 if (r != null)24 this.red = r;25 if (g != null)26 this.green = g;27 if (b != null)28 this.blue = b;29 this.updateHSBFromRGB();30}31SpawColor.prototype.setRGBFromHTML = function(val)32{33 var sval = val;34 if ((sval.length != 4 && sval.length != 7) || sval.charAt(0) != '#') 35 {36 // try named colors37 sval = this.getHTMLColorFromKeyword(sval);38 }39 if (sval != null && (sval.length == 4 || sval.length == 7) && sval.charAt(0) == '#')40 { 41 if (sval.length == 4)42 {43 this.red = this.hex2dec(sval.charAt(1)+sval.charAt(1));44 this.green = this.hex2dec(sval.charAt(2)+sval.charAt(2));45 this.blue = this.hex2dec(sval.charAt(3)+sval.charAt(3));46 }47 else48 {49 this.red = this.hex2dec(sval.substring(1,3));50 this.green = this.hex2dec(sval.substring(3,5));51 this.blue = this.hex2dec(sval.substring(5,7));52 }53 this.updateHSBFromRGB();54 }55}56SpawColor.prototype.getHTMLColorFromKeyword = function(kwd)57{58 var named_colors = new Array();59 named_colors['aliceblue']='#f0f8ff';60 named_colors['antiquewhite']='#faebd7';61 named_colors['aqua']='#00ffff';62 named_colors['aquamarine']='#7fffd4';63 named_colors['azure']='#f0ffff';64 named_colors['beige']='#f5f5dc';65 named_colors['bisque']='#ffe4c4';66 named_colors['black']='#000000';67 named_colors['blanchedalmond']='#ffebcd';68 named_colors['blue']='#0000ff';69 named_colors['blueviolet']='#8a2be2';70 named_colors['brown']='#a52a2a';71 named_colors['burlywood']='#deb887';72 named_colors['cadetblue']='#5f9ea0';73 named_colors['chartreuse']='#7fff00';74 named_colors['chocolate']='#d2691e';75 named_colors['coral']='#ff7f50';76 named_colors['cornflowerblue']='#6495ed';77 named_colors['cornsilk']='#fff8dc';78 named_colors['crimson']='#dc143c';79 named_colors['cyan']='#00ffff';80 named_colors['darkblue']='#00008b';81 named_colors['darkcyan']='#008b8b';82 named_colors['darkgoldenrod']='#b8860b';83 named_colors['darkgray']='#a9a9a9';84 named_colors['darkgreen']='#006400';85 named_colors['darkkhaki']='#bdb76b';86 named_colors['darkmagenta']='#8b008b';87 named_colors['darkolivegreen']='#556b2f';88 named_colors['darkorange']='#ff8c00';89 named_colors['darkorchid']='#9932cc';90 named_colors['darkred']='#8b0000';91 named_colors['darksalmon']='#e9967a';92 named_colors['darkseagreen']='#8fbc8f';93 named_colors['darkslateblue']='#483d8b';94 named_colors['darkslategray']='#2f4f4f';95 named_colors['darkturquoise']='#00ced1';96 named_colors['darkviolet']='#9400d3';97 named_colors['deeppink']='#ff1493';98 named_colors['deepskyblue']='#00bfff';99 named_colors['dimgray']='#696969';100 named_colors['dodgerblue']='#1e90ff';101 named_colors['firebrick']='#b22222';102 named_colors['floralwhite']='#fffaf0';103 named_colors['forestgreen']='#228b22';104 named_colors['fuchsia']='#ff00ff';105 named_colors['gainsboro']='#dcdcdc';106 named_colors['ghostwhite']='#f8f8ff';107 named_colors['gold']='#ffd700';108 named_colors['goldenrod']='#daa520';109 named_colors['gray']='#808080';110 named_colors['green']='#008000';111 named_colors['greenyellow']='#adff2f';112 named_colors['honeydew']='#f0fff0';113 named_colors['hotpink']='#ff69b4';114 named_colors['indianred']='#cd5c5c';115 named_colors['indigo']='#4b0082';116 named_colors['ivory']='#fffff0';117 named_colors['khaki']='#f0e68c';118 named_colors['lavender']='#e6e6fa';119 named_colors['lavenderblush']='#fff0f5';120 named_colors['lawngreen']='#7cfc00';121 named_colors['lemonchiffon']='#fffacd';122 named_colors['lightblue']='#add8e6';123 named_colors['lightcoral']='#f08080';124 named_colors['lightcyan']='#e0ffff';125 named_colors['lightgoldenrodyellow']='#fafad2';126 named_colors['lightgreen']='#90ee90';127 named_colors['lightgrey']='#d3d3d3';128 named_colors['lightpink']='#ffb6c1';129 named_colors['lightsalmon']='#ffa07a';130 named_colors['lightseagreen']='#20b2aa';131 named_colors['lightskyblue']='#87cefa';132 named_colors['lightslategray']='#778899';133 named_colors['lightsteelblue']='#b0c4de';134 named_colors['lightyellow']='#ffffe0';135 named_colors['lime']='#00ff00';136 named_colors['limegreen']='#32cd32';137 named_colors['linen']='#faf0e6';138 named_colors['magenta']='#ff00ff';139 named_colors['maroon']='#800000';140 named_colors['mediumaquamarine']='#66cdaa';141 named_colors['mediumblue']='#0000cd';142 named_colors['mediumorchid']='#ba55d3';143 named_colors['mediumpurple']='#9370db';144 named_colors['mediumseagreen']='#3cb371';145 named_colors['mediumslateblue']='#7b68ee';146 named_colors['mediumspringgreen']='#00fa9a';147 named_colors['mediumturquoise']='#48d1cc';148 named_colors['mediumvioletred']='#c71585';149 named_colors['midnightblue']='#191970';150 named_colors['mintcream']='#f5fffa';151 named_colors['mistyrose']='#ffe4e1';152 named_colors['moccasin']='#ffe4b5';153 named_colors['navajowhite']='#ffdead';154 named_colors['navy']='#000080';155 named_colors['oldlace']='#fdf5e6';156 named_colors['olive']='#808000';157 named_colors['olivedrab']='#6b8e23';158 named_colors['orange']='#ffa500';159 named_colors['orangered']='#ff4500';160 named_colors['orchid']='#da70d6';161 named_colors['palegoldenrod']='#eee8aa';162 named_colors['palegreen']='#98fb98';163 named_colors['paleturquoise']='#afeeee';164 named_colors['palevioletred']='#db7093';165 named_colors['papayawhip']='#ffefd5';166 named_colors['peachpuff']='#ffdab9';167 named_colors['peru']='#cd853f';168 named_colors['pink']='#ffc0cb';169 named_colors['plum']='#dda0dd';170 named_colors['powderblue']='#b0e0e6';171 named_colors['purple']='#800080';172 named_colors['red']='#ff0000';173 named_colors['rosybrown']='#bc8f8f';174 named_colors['royalblue']='#4169e1';175 named_colors['saddlebrown']='#8b4513';176 named_colors['salmon']='#fa8072';177 named_colors['sandybrown']='#f4a460';178 named_colors['seagreen']='#2e8b57';179 named_colors['seashell']='#fff5ee';180 named_colors['sienna']='#a0522d';181 named_colors['silver']='#c0c0c0';182 named_colors['skyblue']='#87ceeb';183 named_colors['slateblue']='#6a5acd';184 named_colors['slategray']='#708090';185 named_colors['snow']='#fffafa';186 named_colors['springgreen']='#00ff7f';187 named_colors['steelblue']='#4682b4';188 named_colors['tan']='#d2b48c';189 named_colors['teal']='#008080';190 named_colors['thistle']='#d8bfd8';191 named_colors['tomato']='#ff6347';192 named_colors['turquoise']='#40e0d0';193 named_colors['violet']='#ee82ee';194 named_colors['wheat']='#f5deb3';195 named_colors['white']='#ffffff';196 named_colors['whitesmoke']='#f5f5f5';197 named_colors['yellow']='#ffff00';198 named_colors['yellowgreen']=['#9acd32'];199 if (named_colors[kwd.toLowerCase()] != null)200 return named_colors[kwd.toLowerCase()];201 else202 return null;203}204SpawColor.parseRGB = function(rgbstr)205{206 var nc = new SpawColor();207 var r, g, b;208 if (!isNaN(parseInt(rgbstr)))209 {210 // number representation211 var n = parseInt(rgbstr);212 r = n%256;213 n = Math.floor(n/256);214 g = n%256;215 n = Math.floor(n/256);216 b = n%256;217 nc.setRGB(r, g, b);218 }219 else if (rgbstr.toLowerCase().indexOf('rgb(') == 0)220 {221 r = parseInt(rgbstr.substring(4, rgbstr.indexOf(',')));222 g = parseInt(rgbstr.substring(rgbstr.indexOf(',')+1, rgbstr.lastIndexOf(',')));223 b = parseInt(rgbstr.substring(rgbstr.lastIndexOf(',')+1, rgbstr.indexOf(')')));224 nc.setRGB(r, g, b);225 }226 else227 {228 nc.setRGBFromHTML(rgbstr);229 }230 return nc;231}232SpawColor.prototype.updateRGBFromHSB = function()233{234 var r,g,b;235 var fS = this.saturation/100;236 var fB = this.brightness/100;237 var hi = Math.floor(this.hue / 60) % 6;238 var f = this.hue / 60 - hi;239 var p = fB * (1 - fS);240 var q = fB * (1 - f * fS);241 var t = fB * (1 - (1 - f) * fS);242 switch (hi)243 {244 case 0:245 r = Math.round(fB * 255);246 g = Math.round(t * 255);247 b = Math.round(p * 255);248 break;249 case 1:250 r = Math.round(q * 255);251 g = Math.round(fB * 255);252 b = Math.round(p * 255);253 break;254 case 2:255 r = Math.round(p * 255);256 g = Math.round(fB * 255);257 b = Math.round(t * 255);258 break;259 case 3:260 r = Math.round(p * 255);261 g = Math.round(q * 255);262 b = Math.round(fB * 255);263 break;264 case 4:265 r = Math.round(t * 255);266 g = Math.round(p * 255);267 b = Math.round(fB * 255);268 break;269 case 5:270 r = Math.round(fB * 255);271 g = Math.round(p * 255);272 b = Math.round(q * 255);273 break;274 }275 this.red = r;276 this.green = g;277 this.blue = b;278}279SpawColor.prototype.updateHSBFromRGB = function()280{281 var h,s;282 var r = this.red/255;283 var g = this.green/255;284 var b = this.blue/255;285 var mx = Math.max(this.red, this.green, this.blue)/255;286 var mn = Math.min(this.red, this.green, this.blue)/255;287 if (mx == mn)288 {289 h = 0;290 }291 else if (mx == r && g>=b)292 {293 h = 60*(g - b)/(mx - mn);294 }295 else if (mx == r && g<b)296 {297 h = 60*(g - b)/(mx - mn) + 360;298 }299 else if (mx == g)300 {301 h = 60*(b - r)/(mx - mn) + 120;302 }303 else if (mx == b)304 {305 h = 60*(r - g)/(mx - mn) + 240;306 }307 308 if (mx == 0)309 s = 0;310 else311 s = Math.round((1 - mn/mx));312 313 this.hue = Math.round(h);314 this.saturation = Math.round(s*100);315 this.brightness = Math.round(mx*100);316}317SpawColor.prototype.dec2hex = function(dec)318{319 var result = '';320 var num = dec;321 while (num/16 >= 1 || num%16 > 0)322 {323 var ch = num%16;324 if (ch>=10)325 {326 switch(ch)327 {328 case 10:329 ch = 'a';330 break;331 case 11:332 ch = 'b';333 break;334 case 12:335 ch = 'c';336 break;337 case 13:338 ch = 'd';339 break;340 case 14:341 ch = 'e';342 break;343 case 15:344 ch = 'f';345 break;346 }347 }348 result = '' + ch + result;349 num = Math.floor(num/16);350 }351 return result;352}353SpawColor.prototype.hex2dec = function(hex)354{355 var l = hex.length;356 var p = 0;357 var result = 0;358 for(var i = l-1; i>=0; i--)359 {360 p = l-i-1;361 var c = hex.charAt(i);362 if (!isNaN(parseInt(c)))363 {364 result += parseInt(c)*Math.pow(16, p); 365 }366 else367 {368 switch(c.toLowerCase())369 {370 case 'a':371 result += 10*Math.pow(16, p);372 break; 373 case 'b':374 result += 11*Math.pow(16, p);375 break; 376 case 'c':377 result += 12*Math.pow(16, p);378 break; 379 case 'd':380 result += 13*Math.pow(16, p);381 break; 382 case 'e':383 result += 14*Math.pow(16, p);384 break; 385 case 'f':386 result += 15*Math.pow(16, p);387 break; 388 }389 }390 }391 return result; 392}393SpawColor.prototype.addZeroes = function(source, num)394{395 var result = source;396 while(result.length<num)397 {398 result = '0' + result;399 }400 return result;401}402SpawColor.prototype.getHtmlColor = function()403{404 return result = '#' + this.addZeroes(this.dec2hex(this.red),2) + this.addZeroes(this.dec2hex(this.green),2) + this.addZeroes(this.dec2hex(this.blue),2); ...

Full Screen

Full Screen

NamedColors.js

Source:NamedColors.js Github

copy

Full Screen

1import { ConsoleColor } from "./ConsoleColor.js";2export class NamedColors {3}4NamedColors.AliceBlue = new ConsoleColor("#F0F8FF");5NamedColors.AntiqueWhite = new ConsoleColor("#FAEBD7");6NamedColors.Aqua = new ConsoleColor("#00FFFF");7NamedColors.Aquamarine = new ConsoleColor("#7FFFD4");8NamedColors.Azure = new ConsoleColor("#F0FFFF");9NamedColors.Beige = new ConsoleColor("#F5F5DC");10NamedColors.Bisque = new ConsoleColor("#FFE4C4");11NamedColors.Black = new ConsoleColor("#000000");12NamedColors.BlanchedAlmond = new ConsoleColor("#FFEBCD");13NamedColors.Blue = new ConsoleColor("#0000FF");14NamedColors.BlueViolet = new ConsoleColor("#8A2BE2");15NamedColors.Brown = new ConsoleColor("#A52A2A");16NamedColors.BurlyWood = new ConsoleColor("#DEB887");17NamedColors.CadetBlue = new ConsoleColor("#5F9EA0");18NamedColors.Chartreuse = new ConsoleColor("#7FFF00");19NamedColors.Chocolate = new ConsoleColor("#D2691E");20NamedColors.Coral = new ConsoleColor("#FF7F50");21NamedColors.CornflowerBlue = new ConsoleColor("#6495ED");22NamedColors.Cornsilk = new ConsoleColor("#FFF8DC");23NamedColors.Crimson = new ConsoleColor("#DC143C");24NamedColors.Cyan = new ConsoleColor("#00FFFF");25NamedColors.DarkBlue = new ConsoleColor("#00008B");26NamedColors.DarkCyan = new ConsoleColor("#008B8B");27NamedColors.DarkGoldenRod = new ConsoleColor("#B8860B");28NamedColors.DarkGray = new ConsoleColor("#A9A9A9");29NamedColors.DarkGrey = new ConsoleColor("#A9A9A9");30NamedColors.DarkGreen = new ConsoleColor("#006400");31NamedColors.DarkKhaki = new ConsoleColor("#BDB76B");32NamedColors.DarkMagenta = new ConsoleColor("#8B008B");33NamedColors.DarkOliveGreen = new ConsoleColor("#556B2F");34NamedColors.DarkOrange = new ConsoleColor("#FF8C00");35NamedColors.DarkOrchid = new ConsoleColor("#9932CC");36NamedColors.DarkRed = new ConsoleColor("#8B0000");37NamedColors.DarkSalmon = new ConsoleColor("#E9967A");38NamedColors.DarkSeaGreen = new ConsoleColor("#8FBC8F");39NamedColors.DarkSlateBlue = new ConsoleColor("#483D8B");40NamedColors.DarkSlateGray = new ConsoleColor("#2F4F4F");41NamedColors.DarkSlateGrey = new ConsoleColor("#2F4F4F");42NamedColors.DarkTurquoise = new ConsoleColor("#00CED1");43NamedColors.DarkViolet = new ConsoleColor("#9400D3");44NamedColors.DeepPink = new ConsoleColor("#FF1493");45NamedColors.DeepSkyBlue = new ConsoleColor("#00BFFF");46NamedColors.DimGray = new ConsoleColor("#696969");47NamedColors.DimGrey = new ConsoleColor("#696969");48NamedColors.DodgerBlue = new ConsoleColor("#1E90FF");49NamedColors.FireBrick = new ConsoleColor("#B22222");50NamedColors.FloralWhite = new ConsoleColor("#FFFAF0");51NamedColors.ForestGreen = new ConsoleColor("#228B22");52NamedColors.Fuchsia = new ConsoleColor("#FF00FF");53NamedColors.Gainsboro = new ConsoleColor("#DCDCDC");54NamedColors.GhostWhite = new ConsoleColor("#F8F8FF");55NamedColors.Gold = new ConsoleColor("#FFD700");56NamedColors.GoldenRod = new ConsoleColor("#DAA520");57NamedColors.Gray = new ConsoleColor("#808080");58NamedColors.Grey = new ConsoleColor("#808080");59NamedColors.Green = new ConsoleColor("#008000");60NamedColors.GreenYellow = new ConsoleColor("#ADFF2F");61NamedColors.HoneyDew = new ConsoleColor("#F0FFF0");62NamedColors.HotPink = new ConsoleColor("#FF69B4");63NamedColors.IndianRed = new ConsoleColor("#CD5C5C");64NamedColors.Indigo = new ConsoleColor("#4B0082");65NamedColors.Ivory = new ConsoleColor("#FFFFF0");66NamedColors.Khaki = new ConsoleColor("#F0E68C");67NamedColors.Lavender = new ConsoleColor("#E6E6FA");68NamedColors.LavenderBlush = new ConsoleColor("#FFF0F5");69NamedColors.LawnGreen = new ConsoleColor("#7CFC00");70NamedColors.LemonChiffon = new ConsoleColor("#FFFACD");71NamedColors.LightBlue = new ConsoleColor("#ADD8E6");72NamedColors.LightCoral = new ConsoleColor("#F08080");73NamedColors.LightCyan = new ConsoleColor("#E0FFFF");74NamedColors.LightGoldenRodYellow = new ConsoleColor("#FAFAD2");75NamedColors.LightGray = new ConsoleColor("#D3D3D3");76NamedColors.LightGrey = new ConsoleColor("#D3D3D3");77NamedColors.LightGreen = new ConsoleColor("#90EE90");78NamedColors.LightPink = new ConsoleColor("#FFB6C1");79NamedColors.LightSalmon = new ConsoleColor("#FFA07A");80NamedColors.LightSeaGreen = new ConsoleColor("#20B2AA");81NamedColors.LightSkyBlue = new ConsoleColor("#87CEFA");82NamedColors.LightSlateGray = new ConsoleColor("#778899");83NamedColors.LightSlateGrey = new ConsoleColor("#778899");84NamedColors.LightSteelBlue = new ConsoleColor("#B0C4DE");85NamedColors.LightYellow = new ConsoleColor("#FFFFE0");86NamedColors.Lime = new ConsoleColor("#00FF00");87NamedColors.LimeGreen = new ConsoleColor("#32CD32");88NamedColors.Linen = new ConsoleColor("#FAF0E6");89NamedColors.Magenta = new ConsoleColor("#FF00FF");90NamedColors.Maroon = new ConsoleColor("#800000");91NamedColors.MediumAquaMarine = new ConsoleColor("#66CDAA");92NamedColors.MediumBlue = new ConsoleColor("#0000CD");93NamedColors.MediumOrchid = new ConsoleColor("#BA55D3");94NamedColors.MediumPurple = new ConsoleColor("#9370DB");95NamedColors.MediumSeaGreen = new ConsoleColor("#3CB371");96NamedColors.MediumSlateBlue = new ConsoleColor("#7B68EE");97NamedColors.MediumSpringGreen = new ConsoleColor("#00FA9A");98NamedColors.MediumTurquoise = new ConsoleColor("#48D1CC");99NamedColors.MediumVioletRed = new ConsoleColor("#C71585");100NamedColors.MidnightBlue = new ConsoleColor("#191970");101NamedColors.MintCream = new ConsoleColor("#F5FFFA");102NamedColors.MistyRose = new ConsoleColor("#FFE4E1");103NamedColors.Moccasin = new ConsoleColor("#FFE4B5");104NamedColors.NavajoWhite = new ConsoleColor("#FFDEAD");105NamedColors.Navy = new ConsoleColor("#000080");106NamedColors.OldLace = new ConsoleColor("#FDF5E6");107NamedColors.Olive = new ConsoleColor("#808000");108NamedColors.OliveDrab = new ConsoleColor("#6B8E23");109NamedColors.Orange = new ConsoleColor("#FFA500");110NamedColors.OrangeRed = new ConsoleColor("#FF4500");111NamedColors.Orchid = new ConsoleColor("#DA70D6");112NamedColors.PaleGoldenRod = new ConsoleColor("#EEE8AA");113NamedColors.PaleGreen = new ConsoleColor("#98FB98");114NamedColors.PaleTurquoise = new ConsoleColor("#AFEEEE");115NamedColors.PaleVioletRed = new ConsoleColor("#DB7093");116NamedColors.PapayaWhip = new ConsoleColor("#FFEFD5");117NamedColors.PeachPuff = new ConsoleColor("#FFDAB9");118NamedColors.Peru = new ConsoleColor("#CD853F");119NamedColors.Pink = new ConsoleColor("#FFC0CB");120NamedColors.Plum = new ConsoleColor("#DDA0DD");121NamedColors.PowderBlue = new ConsoleColor("#B0E0E6");122NamedColors.Purple = new ConsoleColor("#800080");123NamedColors.RebeccaPurple = new ConsoleColor("#663399");124NamedColors.Red = new ConsoleColor("#FF0000");125NamedColors.RosyBrown = new ConsoleColor("#BC8F8F");126NamedColors.RoyalBlue = new ConsoleColor("#4169E1");127NamedColors.SaddleBrown = new ConsoleColor("#8B4513");128NamedColors.Salmon = new ConsoleColor("#FA8072");129NamedColors.SandyBrown = new ConsoleColor("#F4A460");130NamedColors.SeaGreen = new ConsoleColor("#2E8B57");131NamedColors.SeaShell = new ConsoleColor("#FFF5EE");132NamedColors.Sienna = new ConsoleColor("#A0522D");133NamedColors.Silver = new ConsoleColor("#C0C0C0");134NamedColors.SkyBlue = new ConsoleColor("#87CEEB");135NamedColors.SlateBlue = new ConsoleColor("#6A5ACD");136NamedColors.SlateGray = new ConsoleColor("#708090");137NamedColors.SlateGrey = new ConsoleColor("#708090");138NamedColors.Snow = new ConsoleColor("#FFFAFA");139NamedColors.SpringGreen = new ConsoleColor("#00FF7F");140NamedColors.SteelBlue = new ConsoleColor("#4682B4");141NamedColors.Tan = new ConsoleColor("#D2B48C");142NamedColors.Teal = new ConsoleColor("#008080");143NamedColors.Thistle = new ConsoleColor("#D8BFD8");144NamedColors.Tomato = new ConsoleColor("#FF6347");145NamedColors.Turquoise = new ConsoleColor("#40E0D0");146NamedColors.Violet = new ConsoleColor("#EE82EE");147NamedColors.Wheat = new ConsoleColor("#F5DEB3");148NamedColors.White = new ConsoleColor("#FFFFFF");149NamedColors.WhiteSmoke = new ConsoleColor("#F5F5F5");150NamedColors.Yellow = new ConsoleColor("#FFFF00");...

Full Screen

Full Screen

es6ImportNamedImportInEs5.js

Source:es6ImportNamedImportInEs5.js Github

copy

Full Screen

1//// [tests/cases/compiler/es6ImportNamedImportInEs5.ts] ////23//// [es6ImportNamedImportInEs5_0.ts]4export var a = 10;5export var x = a;6export var m = a;7export var a1 = 10;8export var x1 = 10;9export var z1 = 10;10export var z2 = 10;11export var aaaa = 10;1213//// [es6ImportNamedImportInEs5_1.ts]14import { } from "./es6ImportNamedImportInEs5_0";15import { a } from "./es6ImportNamedImportInEs5_0";16var xxxx = a;17import { a as b } from "./es6ImportNamedImportInEs5_0";18var xxxx = b;19import { x, a as y } from "./es6ImportNamedImportInEs5_0";20var xxxx = x;21var xxxx = y;22import { x as z, } from "./es6ImportNamedImportInEs5_0";23var xxxx = z;24import { m, } from "./es6ImportNamedImportInEs5_0";25var xxxx = m;26import { a1, x1 } from "./es6ImportNamedImportInEs5_0";27var xxxx = a1;28var xxxx = x1;29import { a1 as a11, x1 as x11 } from "./es6ImportNamedImportInEs5_0";30var xxxx = a11;31var xxxx = x11;32import { z1 } from "./es6ImportNamedImportInEs5_0";33var z111 = z1;34import { z2 as z3 } from "./es6ImportNamedImportInEs5_0";35var z2 = z3; // z2 shouldn't give redeclare error36// These are elided37import { aaaa } from "./es6ImportNamedImportInEs5_0";38// These are elided39import { aaaa as bbbb } from "./es6ImportNamedImportInEs5_0";404142//// [es6ImportNamedImportInEs5_0.js]43"use strict";44Object.defineProperty(exports, "__esModule", { value: true });45exports.aaaa = exports.z2 = exports.z1 = exports.x1 = exports.a1 = exports.m = exports.x = exports.a = void 0;46exports.a = 10;47exports.x = exports.a;48exports.m = exports.a;49exports.a1 = 10;50exports.x1 = 10;51exports.z1 = 10;52exports.z2 = 10;53exports.aaaa = 10;54//// [es6ImportNamedImportInEs5_1.js]55"use strict";56Object.defineProperty(exports, "__esModule", { value: true });57var es6ImportNamedImportInEs5_0_1 = require("./es6ImportNamedImportInEs5_0");58var xxxx = es6ImportNamedImportInEs5_0_1.a;59var es6ImportNamedImportInEs5_0_2 = require("./es6ImportNamedImportInEs5_0");60var xxxx = es6ImportNamedImportInEs5_0_2.a;61var es6ImportNamedImportInEs5_0_3 = require("./es6ImportNamedImportInEs5_0");62var xxxx = es6ImportNamedImportInEs5_0_3.x;63var xxxx = es6ImportNamedImportInEs5_0_3.a;64var es6ImportNamedImportInEs5_0_4 = require("./es6ImportNamedImportInEs5_0");65var xxxx = es6ImportNamedImportInEs5_0_4.x;66var es6ImportNamedImportInEs5_0_5 = require("./es6ImportNamedImportInEs5_0");67var xxxx = es6ImportNamedImportInEs5_0_5.m;68var es6ImportNamedImportInEs5_0_6 = require("./es6ImportNamedImportInEs5_0");69var xxxx = es6ImportNamedImportInEs5_0_6.a1;70var xxxx = es6ImportNamedImportInEs5_0_6.x1;71var es6ImportNamedImportInEs5_0_7 = require("./es6ImportNamedImportInEs5_0");72var xxxx = es6ImportNamedImportInEs5_0_7.a1;73var xxxx = es6ImportNamedImportInEs5_0_7.x1;74var es6ImportNamedImportInEs5_0_8 = require("./es6ImportNamedImportInEs5_0");75var z111 = es6ImportNamedImportInEs5_0_8.z1;76var es6ImportNamedImportInEs5_0_9 = require("./es6ImportNamedImportInEs5_0");77var z2 = es6ImportNamedImportInEs5_0_9.z2; // z2 shouldn't give redeclare error787980//// [es6ImportNamedImportInEs5_0.d.ts]81export declare var a: number;82export declare var x: number;83export declare var m: number;84export declare var a1: number;85export declare var x1: number;86export declare var z1: number;87export declare var z2: number;88export declare var aaaa: number;89//// [es6ImportNamedImportInEs5_1.d.ts] ...

Full Screen

Full Screen

es6ImportNamedImportAmd.js

Source:es6ImportNamedImportAmd.js Github

copy

Full Screen

1//// [tests/cases/compiler/es6ImportNamedImportAmd.ts] ////23//// [es6ImportNamedImportAmd_0.ts]4export var a = 10;5export var x = a;6export var m = a;7export var a1 = 10;8export var x1 = 10;9export var z1 = 10;10export var z2 = 10;11export var aaaa = 10;1213//// [es6ImportNamedImportAmd_1.ts]14import { } from "es6ImportNamedImportAmd_0";15import { a } from "es6ImportNamedImportAmd_0";16var xxxx = a;17import { a as b } from "es6ImportNamedImportAmd_0";18var xxxx = b;19import { x, a as y } from "es6ImportNamedImportAmd_0";20var xxxx = x;21var xxxx = y;22import { x as z, } from "es6ImportNamedImportAmd_0";23var xxxx = z;24import { m, } from "es6ImportNamedImportAmd_0";25var xxxx = m;26import { a1, x1 } from "es6ImportNamedImportAmd_0";27var xxxx = a1;28var xxxx = x1;29import { a1 as a11, x1 as x11 } from "es6ImportNamedImportAmd_0";30var xxxx = a11;31var xxxx = x11;32import { z1 } from "es6ImportNamedImportAmd_0";33var z111 = z1;34import { z2 as z3 } from "es6ImportNamedImportAmd_0";35var z2 = z3; // z2 shouldn't give redeclare error36// These are elided37import { aaaa } from "es6ImportNamedImportAmd_0";38// These are elided39import { aaaa as bbbb } from "es6ImportNamedImportAmd_0";404142//// [es6ImportNamedImportAmd_0.js]43define(["require", "exports"], function (require, exports) {44 "use strict";45 exports.__esModule = true;46 exports.aaaa = exports.z2 = exports.z1 = exports.x1 = exports.a1 = exports.m = exports.x = exports.a = void 0;47 exports.a = 10;48 exports.x = exports.a;49 exports.m = exports.a;50 exports.a1 = 10;51 exports.x1 = 10;52 exports.z1 = 10;53 exports.z2 = 10;54 exports.aaaa = 10;55});56//// [es6ImportNamedImportAmd_1.js]57define(["require", "exports", "es6ImportNamedImportAmd_0", "es6ImportNamedImportAmd_0", "es6ImportNamedImportAmd_0", "es6ImportNamedImportAmd_0", "es6ImportNamedImportAmd_0", "es6ImportNamedImportAmd_0", "es6ImportNamedImportAmd_0", "es6ImportNamedImportAmd_0", "es6ImportNamedImportAmd_0"], function (require, exports, es6ImportNamedImportAmd_0_1, es6ImportNamedImportAmd_0_2, es6ImportNamedImportAmd_0_3, es6ImportNamedImportAmd_0_4, es6ImportNamedImportAmd_0_5, es6ImportNamedImportAmd_0_6, es6ImportNamedImportAmd_0_7, es6ImportNamedImportAmd_0_8, es6ImportNamedImportAmd_0_9) {58 "use strict";59 exports.__esModule = true;60 var xxxx = es6ImportNamedImportAmd_0_1.a;61 var xxxx = es6ImportNamedImportAmd_0_2.a;62 var xxxx = es6ImportNamedImportAmd_0_3.x;63 var xxxx = es6ImportNamedImportAmd_0_3.a;64 var xxxx = es6ImportNamedImportAmd_0_4.x;65 var xxxx = es6ImportNamedImportAmd_0_5.m;66 var xxxx = es6ImportNamedImportAmd_0_6.a1;67 var xxxx = es6ImportNamedImportAmd_0_6.x1;68 var xxxx = es6ImportNamedImportAmd_0_7.a1;69 var xxxx = es6ImportNamedImportAmd_0_7.x1;70 var z111 = es6ImportNamedImportAmd_0_8.z1;71 var z2 = es6ImportNamedImportAmd_0_9.z2; // z2 shouldn't give redeclare error72});737475//// [es6ImportNamedImportAmd_0.d.ts]76export declare var a: number;77export declare var x: number;78export declare var m: number;79export declare var a1: number;80export declare var x1: number;81export declare var z1: number;82export declare var z2: number;83export declare var aaaa: number;84//// [es6ImportNamedImportAmd_1.d.ts] ...

Full Screen

Full Screen

es6ImportNamedImport.js

Source:es6ImportNamedImport.js Github

copy

Full Screen

1//// [tests/cases/compiler/es6ImportNamedImport.ts] ////23//// [es6ImportNamedImport_0.ts]4export var a = 10;5export var x = a;6export var m = a;7export var a1 = 10;8export var x1 = 10;9export var z1 = 10;10export var z2 = 10;11export var aaaa = 10;1213//// [es6ImportNamedImport_1.ts]14import { } from "./es6ImportNamedImport_0";15import { a } from "./es6ImportNamedImport_0";16var xxxx = a;17import { a as b } from "./es6ImportNamedImport_0";18var xxxx = b;19import { x, a as y } from "./es6ImportNamedImport_0";20var xxxx = x;21var xxxx = y;22import { x as z, } from "./es6ImportNamedImport_0";23var xxxx = z;24import { m, } from "./es6ImportNamedImport_0";25var xxxx = m;26import { a1, x1 } from "./es6ImportNamedImport_0";27var xxxx = a1;28var xxxx = x1;29import { a1 as a11, x1 as x11 } from "./es6ImportNamedImport_0";30var xxxx = a11;31var xxxx = x11;32import { z1 } from "./es6ImportNamedImport_0";33var z111 = z1;34import { z2 as z3 } from "./es6ImportNamedImport_0";35var z2 = z3; // z2 shouldn't give redeclare error36// These are elided37import { aaaa } from "./es6ImportNamedImport_0";38// These are elided39import { aaaa as bbbb } from "./es6ImportNamedImport_0";404142//// [es6ImportNamedImport_0.js]43"use strict";44Object.defineProperty(exports, "__esModule", { value: true });45exports.aaaa = exports.z2 = exports.z1 = exports.x1 = exports.a1 = exports.m = exports.x = exports.a = void 0;46exports.a = 10;47exports.x = exports.a;48exports.m = exports.a;49exports.a1 = 10;50exports.x1 = 10;51exports.z1 = 10;52exports.z2 = 10;53exports.aaaa = 10;54//// [es6ImportNamedImport_1.js]55"use strict";56Object.defineProperty(exports, "__esModule", { value: true });57const es6ImportNamedImport_0_1 = require("./es6ImportNamedImport_0");58var xxxx = es6ImportNamedImport_0_1.a;59const es6ImportNamedImport_0_2 = require("./es6ImportNamedImport_0");60var xxxx = es6ImportNamedImport_0_2.a;61const es6ImportNamedImport_0_3 = require("./es6ImportNamedImport_0");62var xxxx = es6ImportNamedImport_0_3.x;63var xxxx = es6ImportNamedImport_0_3.a;64const es6ImportNamedImport_0_4 = require("./es6ImportNamedImport_0");65var xxxx = es6ImportNamedImport_0_4.x;66const es6ImportNamedImport_0_5 = require("./es6ImportNamedImport_0");67var xxxx = es6ImportNamedImport_0_5.m;68const es6ImportNamedImport_0_6 = require("./es6ImportNamedImport_0");69var xxxx = es6ImportNamedImport_0_6.a1;70var xxxx = es6ImportNamedImport_0_6.x1;71const es6ImportNamedImport_0_7 = require("./es6ImportNamedImport_0");72var xxxx = es6ImportNamedImport_0_7.a1;73var xxxx = es6ImportNamedImport_0_7.x1;74const es6ImportNamedImport_0_8 = require("./es6ImportNamedImport_0");75var z111 = es6ImportNamedImport_0_8.z1;76const es6ImportNamedImport_0_9 = require("./es6ImportNamedImport_0");77var z2 = es6ImportNamedImport_0_9.z2; // z2 shouldn't give redeclare error787980//// [es6ImportNamedImport_0.d.ts]81export declare var a: number;82export declare var x: number;83export declare var m: number;84export declare var a1: number;85export declare var x1: number;86export declare var z1: number;87export declare var z2: number;88export declare var aaaa: number;89//// [es6ImportNamedImport_1.d.ts] ...

Full Screen

Full Screen

Jest Testing Tutorial

LambdaTest’s Jest Testing Tutorial covers step-by-step guides around Jest with code examples to help you be proficient with the Jest framework. The Jest tutorial has chapters to help you learn right from the basics of Jest framework to code-based tutorials around testing react apps with Jest, perform snapshot testing, import ES modules and more.

Chapters

  1. What is Jest Framework
  2. Advantages of Jest - Jest has 3,898,000 GitHub repositories, as mentioned on its official website. Learn what makes Jest special and why Jest has gained popularity among the testing and developer community.
  3. Jest Installation - All the prerequisites and set up steps needed to help you start Jest automation testing.
  4. Using Jest with NodeJS Project - Learn how to leverage Jest framework to automate testing using a NodeJS Project.
  5. Writing First Test for Jest Framework - Get started with code-based tutorial to help you write and execute your first Jest framework testing script.
  6. Jest Vocabulary - Learn the industry renowned and official jargons of the Jest framework by digging deep into the Jest vocabulary.
  7. Unit Testing with Jest - Step-by-step tutorial to help you execute unit testing with Jest framework.
  8. Jest Basics - Learn about the most pivotal and basic features which makes Jest special.
  9. Jest Parameterized Tests - Avoid code duplication and fasten automation testing with Jest using parameterized tests. Parameterization allows you to trigger the same test scenario over different test configurations by incorporating parameters.
  10. Jest Matchers - Enforce assertions better with the help of matchers. Matchers help you compare the actual output with the expected one. Here is an example to see if the object is acquired from the correct class or not. -

|<p>it('check_object_of_Car', () => {</p><p> expect(newCar()).toBeInstanceOf(Car);</p><p> });</p>| | :- |

  1. Jest Hooks: Setup and Teardown - Learn how to set up conditions which needs to be followed by the test execution and incorporate a tear down function to free resources after the execution is complete.
  2. Jest Code Coverage - Unsure there is no code left unchecked in your application. Jest gives a specific flag called --coverage to help you generate code coverage.
  3. HTML Report Generation - Learn how to create a comprehensive HTML report based on your Jest test execution.
  4. Testing React app using Jest Framework - Learn how to test your react web-application with Jest framework in this detailed Jest tutorial.
  5. Test using LambdaTest cloud Selenium Grid - Run your Jest testing script over LambdaTest cloud-based platform and leverage parallel testing to help trim down your test execution time.
  6. Snapshot Testing for React Front Ends - Capture screenshots of your react based web-application and compare them automatically for visual anomalies with the help of Jest tutorial.
  7. Bonus: Import ES modules with Jest - ES modules are also known as ECMAScript modules. Learn how to best use them by importing in your Jest testing scripts.
  8. Jest vs Mocha vs Jasmine - Learn the key differences between the most popular JavaScript-based testing frameworks i.e. Jest, Mocha, and Jasmine.
  9. Jest FAQs(Frequently Asked Questions) - Explore the most commonly asked questions around Jest framework, with their answers.

Run Jest 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