How to use stop method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

graphics-gradients-tests.js

Source:graphics-gradients-tests.js Github

copy

Full Screen

1YUI.add('graphics-gradients-tests', function(Y) {2 var suite = new Y.Test.Suite('graphics-gradients-tests example test suite'),3 _getClassName = Y.ClassNameManager.getClassName,4 SHAPE,5 RECT,6 CIRCLE,7 ENGINE = "vml",8 DOCUMENT = Y.config.doc,9 canvas = DOCUMENT && DOCUMENT.createElement("canvas"),10 graphicTests,11 svgTests,12 canvasTests,13 vmlTests,14 PATHNODE = "shape",15 TORGB = Y.Color.toRGB,16 TOHEX = Y.Color.toHex,17 toRGBA = function(val, alpha) {18 alpha = Y.Lang.isNumber(alpha) ? alpha : 1;19 if (!Y.Color.re_RGB.test(val)) {20 val = TOHEX(val);21 }22 if(Y.Color.re_hex.exec(val)) {23 val = 'rgba(' + [24 parseInt(RegExp.$1, 16),25 parseInt(RegExp.$2, 16),26 parseInt(RegExp.$3, 16)27 ].join(',') + ',' + alpha + ')';28 }29 return val;30 },31 IMPLEMENTATION;32 if(DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"))33 {34 ENGINE = "svg";35 }36 else if(canvas && canvas.getContext && canvas.getContext("2d"))37 {38 ENGINE = "canvas";39 }40 SHAPE = "." + _getClassName(ENGINE + "Shape");41 RECT = "." + _getClassName(ENGINE + "Rect");42 CIRCLE = "." + _getClassName(ENGINE + "Circle");43 IMPLEMENTATION = {44 svg: {45 getStroke: function()46 {47 var node = this._node,48 color = node.getAttribute("stroke"),49 weight = node.getAttribute("stroke-width"),50 opacity = node.getAttribute("stroke-opacity");51 color = toRGBA(TOHEX(color), opacity);52 return {53 color: color,54 weight: weight55 }56 },57 58 getFill: function()59 {60 var node = this._node,61 fillNode,62 stopNodes,63 len,64 i = 0,65 stops,66 stop,67 stopNode,68 offset,69 gradientIndex,70 tagName,71 type,72 color = node.getAttribute("fill"),73 opacity = node.getAttribute("fill-opacity"),74 fill = {};75 if(color.indexOf("url") > -1)76 {77 color = color.slice(color.indexOf("#"), color.lastIndexOf(")"));78 fillNode = Y.one(color);79 if(fillNode)80 {81 tagName = fillNode.get("tagName");82 if(tagName)83 {84 gradientIndex = tagName.indexOf("Gradient");85 if(gradientIndex > -1)86 {87 type = tagName.slice(tagName.indexOf(":") + 1, gradientIndex);88 if(type == "linear")89 {90 //add rotation logic91 }92 else if(type == "radial")93 {94 //add cx,cy,fx,fy,r logic95 }96 }97 fill.type = type;98 }99 stopNodes = fillNode.get("children");100 stopNodes = stopNodes ? stopNodes.filter("stop") : null;101 if(stopNodes)102 { 103 len = stopNodes.size();104 stops = [];105 for(; i < len; i = i + 1)106 {107 stopNode = stopNodes.item(i);108 stop = {};109 if(stopNode.hasAttribute("stop-color"))110 {111 stop.color = TOHEX(stopNode.getAttribute("stop-color")).toLowerCase();112 }113 if(stopNode.hasAttribute("offset"))114 {115 offset = stopNode.getAttribute("offset");116 if(offset.indexOf("%") > -1)117 {118 offset = parseFloat(offset)/100;119 }120 else121 {122 offset = 1;123 }124 stop.offset = offset;125 }126 if(stopNode.hasAttribute("stop-opacity"))127 {128 stop.opacity = stopNode.getAttribute("stop-opacity");129 }130 stops.push(stop);131 }132 fill.stops = stops;133 }134 }135 }136 else137 {138 color = toRGBA(TOHEX(color), opacity);139 fill.color = color;140 fill.type = "solid";141 }142 return fill;143 },144 getDimensions: function(shape)145 {146 var w,147 h,148 node = this._node;149 switch(shape)150 {151 case "circle" :152 w = node.getAttribute("r") * 2;153 h = w;154 break;155 case "ellipse" :156 w = parseFloat(node.getAttribute("rx")) * 2;157 h = parseFloat(node.getAttribute("ry")) * 2;158 break;159 default :160 w = node.getAttribute("width");161 h = node.getAttribute("height");162 break;163 }164 return {165 width: w,166 height: h167 }168 }169 },170 vml: {171 getStroke: function()172 {173 var node = Y.one(this._node),174 nodelist = node.get("children"),175 strokeNode,176 color,177 weight,178 opacity;179 if(nodelist)180 {181 strokeNode = nodelist.filter('stroke');182 if(strokeNode.size() > 0)183 {184 strokeNode = strokeNode.shift().getDOMNode();185 }186 }187 color = node.get("strokecolor");188 weight = node.get("strokeweight");189 opacity = strokeNode ? strokeNode.opacity : 1;190 if(!Y.Lang.isNumber(opacity))191 {192 opacity = 1;193 }194 if(color.value)195 {196 color = color.value;197 }198 color = toRGBA(TOHEX(color), parseFloat(opacity));199 weight = Math.round(weight * (96/72));200 return {201 color: color,202 weight: weight203 }204 },205 206 getFill: function()207 {208 var node = this._node,209 nodelist = Y.one(node).get("children"),210 type,211 fillNode,212 color,213 offset,214 stops,215 stopAttrs,216 stopStrings,217 opacity,218 i = 0,219 len,220 fill = {};221 if(nodelist)222 {223 fillNode = nodelist.filter("fill");224 if(fillNode.size() > 0)225 {226 fillNode = fillNode.shift().getDOMNode();227 }228 type = fillNode.type || "solid";229 if(type == "gradient")230 {231 type = "linear";232 }233 else if(type == "gradientRadial")234 {235 type = "radial";236 }237 }238 else239 {240 type = "solid";241 }242 switch(type)243 {244 case "solid" :245 color = node.get("fillcolor");246 opacity = fillNode ? fillNode.opacity : 1;247 if(color.value)248 {249 color = color.value;250 }251 color = toRGBA(TOHEX(color), parseFloat(opacity)); 252 fill.color = color;253 break;254 case "linear" :255 stopStrings = fillNode.colors;256 if(stopStrings)257 {258 stops = [];259 if(stopStrings.value)260 {261 stopStrings = stopStrings.value;262 }263 stopStrings = stopStrings.split(";");264 len = stops.length;265 for(; i < len; i = i + 1)266 {267 stopAttrs = stopStrings[i].split(" ");268 offset = stopAttrs[0];269 if(offset.indexOf("f") > -1)270 {271 offset = 100 * parseFloat(offset)/65535272 offset = Math.round(offset)/100;273 }274 stops.push( {color: TOHEX(stopAttrs[1]).toLowerCase(), offset: offset} );275 }276 fill.stops = stops;277 }278 break;279 case "radial" :280 stopStrings = fillNode.colors;281 if(stopStrings)282 {283 stops = [];284 if(stopStrings.value)285 {286 stopStrings = stopStrings.value;287 }288 stopStrings = stopStrings.split(";");289 len = stops.length;290 for(; i < len; i = i + 1)291 {292 stopAttrs = stopStrings[i].split(" ");293 offset = stopAttrs[0];294 if(offset.indexOf("f") > -1)295 {296 offset = 100 * parseFloat(offset)/65535297 offset = Math.round(offset)/100;298 }299 stops.push( {color: TOHEX(stopAttrs[1]).toLowerCase(), offset: offset} );300 }301 fill.stops = stops;302 }303 break;304 }305 fill.type = type;306 return fill;307 },308 getDimensions: function(shape)309 {310 var node = this._node,311 w = parseFloat(node.getComputedStyle("width")),312 h = parseFloat(node.getComputedStyle("height"));313 return {314 width: w,315 height: h316 };317 }318 },319 canvas: {320 getStroke: function()321 {322 var context = this._node.getDOMNode().getContext("2d"),323 color = context.strokeStyle,324 weight = context.lineWidth;325 if(color.indexOf("RGBA") > -1 || color.indexOf("rgba") > -1)326 {327 color = color.toLowerCase();328 color = color.replace(/, /g, ",");329 }330 else331 {332 color = toRGBA(TOHEX(color));333 }334 return {335 color: color,336 weight: weight337 }338 },339 getFill: function()340 {341 var context = this._node.getDOMNode().getContext("2d"),342 color = context.fillStyle;343 if(color.indexOf("RGBA") > -1 || color.indexOf("rgba") > -1)344 {345 color = color.toLowerCase();346 color = color.replace(/, /g, ",");347 }348 else349 {350 color = toRGBA(TOHEX(color));351 }352 return {353 color: color354 }355 },356 getDimensions: function(shape)357 {358 var node = this._node,359 w = parseFloat(node.get("width")),360 h = parseFloat(node.get("height")),361 wt = this.getStroke().weight || 0;362 if(wt) {363 wt = wt * 2;364 w = w - wt;365 h = h - wt;366 }367 return {368 width: w,369 height: h370 };371 }372 }373 };374 function ShapeNode(){}375 ShapeNode.prototype = IMPLEMENTATION[ENGINE];376 ShapeNode.one = function(node)377 {378 var instance = ShapeNode._instance;379 if(!instance)380 {381 instance = new Y.ShapeNode();382 ShapeNode._instance = instance;383 }384 instance._node = node;385 return instance;386 };387 Y.ShapeNode = ShapeNode;388 suite.add(new Y.Test.Case({389 name: "Graphics Gradient Tests",390 testGraphicsLoaded : function()391 {392 var shapes = Y.all(SHAPE);393 Y.Assert.areEqual(2, shapes.size(), "There should be 2 shapes.");394 },395 testRect: function()396 {397 var rect = Y.all(RECT).shift(),398 rectWidth = 685,399 rectHeight = 400,400 rectDimensions = Y.ShapeNode.one(rect).getDimensions("rect"),401 defaultStops = [402 {color: "#ff6666", opacity: 1, offset: 0},403 {color: "#00ffff", opacity: 1, offset: 0.5},404 {color: "#000000", opacity: 1, offset: 1}405 ],406 defaultStop,407 i = 0,408 len = defaultStops.length,409 fill,410 stops,411 key,412 stop;413 Y.Assert.areEqual(rectWidth, rectDimensions.width, "The width of the rectangle should be " + rectWidth + ".");414 Y.Assert.areEqual(rectHeight, rectDimensions.height, "The height of the rectangle should be " + rectHeight + ".");415 if(ENGINE != "canvas")416 {417 fill = Y.ShapeNode.one(rect).getFill();418 stops = fill.stops;419 for(; i < len; i = i + 1)420 {421 stop = stops[i];422 defaultStop = defaultStops[i];423 for(key in stop)424 {425 if(stop.hasOwnProperty(key))426 {427 Y.Assert.areEqual(defaultStop[key], stop[key], "The " + key + " value should be " + defaultStop[key] + ".");428 }429 }430 }431 }432 },433 testCircle: function()434 {435 var circle = Y.all(CIRCLE).shift(),436 circleWidth = 100,437 circleHeight = 100,438 circleDimensions = Y.ShapeNode.one(circle).getDimensions("circle"),439 defaultStops = [440 {color: "#ff6666", offset: 0, opacity: 1},441 {color: "#00ffff", offset: 0.4, opacity: 1},442 {color: "#000000", offset: 0.7, opacity: 1}443 ],444 defaultStop,445 i = 0,446 len = defaultStops.length,447 fill,448 stops,449 key,450 stop;451 Y.Assert.areEqual(circleWidth, circleDimensions.width, "The width of the circle should be " + circleWidth + ".");452 Y.Assert.areEqual(circleHeight, circleDimensions.height, "The height of the circle should be " + circleHeight + ".");453 if(ENGINE != "canvas")454 {455 fill = Y.ShapeNode.one(circle).getFill();456 stops = fill.stops;457 for(; i < len; i = i + 1)458 {459 stop = stops[i];460 defaultStop = defaultStops[i];461 if(stop && defaultStops)462 {463 for(key in stop)464 {465 if(stop.hasOwnProperty(key))466 {467 Y.Assert.areEqual(defaultStop[key], stop[key], "The " + key + " value should be " + defaultStop[key] + ".");468 }469 }470 }471 }472 }473 }474 }));475 Y.Test.Runner.add(suite);...

Full Screen

Full Screen

graphics-customshape-tests.js

Source:graphics-customshape-tests.js Github

copy

Full Screen

1YUI.add('graphics-customshape-tests', function(Y) {2 var suite = new Y.Test.Suite('graphics-customshape-tests example test suite'),3 _getClassName = Y.ClassNameManager.getClassName,4 SHAPE,5 ENGINE = "vml",6 ROUNDEDRECT,7 DOCUMENT = Y.config.doc,8 canvas = DOCUMENT && DOCUMENT.createElement("canvas"),9 graphicTests,10 svgTests,11 canvasTests,12 vmlTests,13 TORGB = Y.Color.toRGB,14 TOHEX = Y.Color.toHex,15 toRGBA = function(val, alpha) {16 alpha = Y.Lang.isNumber(alpha) ? alpha : 1;17 if (!Y.Color.re_RGB.test(val)) {18 val = TOHEX(val);19 }20 if(Y.Color.re_hex.exec(val)) {21 val = 'rgba(' + [22 parseInt(RegExp.$1, 16),23 parseInt(RegExp.$2, 16),24 parseInt(RegExp.$3, 16)25 ].join(',') + ',' + alpha + ')';26 }27 return val;28 },29 IMPLEMENTATION;30 if(DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"))31 {32 ENGINE = "svg";33 }34 else if(canvas && canvas.getContext && canvas.getContext("2d"))35 {36 ENGINE = "canvas";37 }38 SHAPE = "." + _getClassName(ENGINE + "Shape");39 ROUNDEDRECT = "." + _getClassName("roundedRect");40 IMPLEMENTATION = {41 svg: {42 getStroke: function()43 {44 var node = this._node,45 color = node.getAttribute("stroke"),46 weight = node.getAttribute("stroke-width"),47 opacity = node.getAttribute("stroke-opacity");48 color = toRGBA(TOHEX(color), opacity);49 return {50 color: color,51 weight: weight52 }53 },54 55 getFill: function()56 {57 var node = this._node,58 fillNode,59 stopNodes,60 len,61 i = 0,62 stops,63 stop,64 stopNode,65 offset,66 gradientIndex,67 tagName,68 type,69 color = node.getAttribute("fill"),70 opacity = node.getAttribute("fill-opacity"),71 fill = {};72 if(color.indexOf("url") > -1)73 {74 color = color.slice(color.indexOf("#"), color.lastIndexOf(")"));75 fillNode = Y.one(color);76 if(fillNode)77 {78 tagName = fillNode.get("tagName");79 if(tagName)80 {81 gradientIndex = tagName.indexOf("Gradient");82 if(gradientIndex > -1)83 {84 type = tagName.slice(tagName.indexOf(":") + 1, gradientIndex);85 if(type == "linear")86 {87 //add rotation logic88 }89 else if(type == "radial")90 {91 //add cx,cy,fx,fy,r logic92 }93 }94 fill.type = type;95 }96 stopNodes = fillNode.get("children");97 stopNodes = stopNodes ? stopNodes.filter("stop") : null;98 if(stopNodes)99 { 100 len = stopNodes.size();101 stops = [];102 for(; i < len; i = i + 1)103 {104 stopNode = stopNodes.item(i);105 stop = {};106 if(stopNode.hasAttribute("stop-color"))107 {108 stop.color = TOHEX(stopNode.getAttribute("stop-color")).toLowerCase();109 }110 if(stopNode.hasAttribute("offset"))111 {112 offset = stopNode.getAttribute("offset");113 if(offset.indexOf("%") > -1)114 {115 offset = parseFloat(offset)/100;116 }117 else118 {119 offset = 1;120 }121 stop.offset = offset;122 }123 if(stopNode.hasAttribute("stop-opacity"))124 {125 stop.opacity = stopNode.getAttribute("stop-opacity");126 }127 stops.push(stop);128 }129 fill.stops = stops;130 }131 }132 }133 else134 {135 color = toRGBA(TOHEX(color), opacity);136 fill.color = color;137 fill.type = "solid";138 }139 return fill;140 },141 getDimensions: function(shape)142 {143 var w,144 h,145 node = this._node;146 switch(shape)147 {148 case "circle" :149 w = node.getAttribute("r") * 2;150 h = w;151 break;152 case "ellipse" :153 w = parseFloat(node.getAttribute("rx")) * 2;154 h = parseFloat(node.getAttribute("ry")) * 2;155 break;156 default :157 w = node.get("width");158 h = node.get("height");159 break;160 }161 return {162 width: w,163 height: h164 }165 }166 },167 vml: {168 getStroke: function()169 {170 var node = Y.one(this._node),171 nodelist = node.get("children"),172 strokeNode,173 color,174 weight,175 opacity;176 if(nodelist)177 {178 strokeNode = nodelist.filter('stroke');179 if(strokeNode.size() > 0)180 {181 strokeNode = strokeNode.shift().getDOMNode();182 }183 }184 color = node.get("strokecolor");185 weight = node.get("strokeweight");186 opacity = strokeNode ? strokeNode.opacity : 1;187 if(!Y.Lang.isNumber(opacity))188 {189 opacity = 1;190 }191 if(color.value)192 {193 color = color.value;194 }195 color = toRGBA(TOHEX(color), parseFloat(opacity));196 weight = Math.round(weight * (96/72));197 return {198 color: color,199 weight: weight200 }201 },202 getFill: function()203 {204 var node = this._node,205 nodelist = Y.one(node).get("children"),206 type,207 fillNode,208 color,209 offset,210 stops,211 stopAttrs,212 stopStrings,213 opacity,214 i = 0,215 len,216 fill = {};217 if(nodelist)218 {219 fillNode = nodelist.filter("fill");220 if(fillNode.size() > 0)221 {222 fillNode = fillNode.shift().getDOMNode();223 }224 type = fillNode.type || "solid";225 if(type == "gradient")226 {227 type = "linear";228 }229 else if(type == "gradientRadial")230 {231 type = "radial";232 }233 }234 else235 {236 type = "solid";237 }238 switch(type)239 {240 case "solid" :241 color = node.get("fillcolor");242 opacity = fillNode ? fillNode.opacity : 1;243 if(color.value)244 {245 color = color.value;246 }247 color = toRGBA(TOHEX(color), parseFloat(opacity)); 248 fill.color = color;249 break;250 case "linear" :251 stopStrings = fillNode.colors;252 if(stopStrings)253 {254 stops = [];255 if(stopStrings.value)256 {257 stopStrings = stopStrings.value;258 }259 stopStrings = stopStrings.split(";");260 len = stops.length;261 for(; i < len; i = i + 1)262 {263 stopAttrs = stopStrings[i].split(" ");264 offset = stopAttrs[0];265 if(offset.indexOf("f") > -1)266 {267 offset = 100 * parseFloat(offset)/65535268 offset = Math.round(offset)/100;269 }270 stops.push( {color: TOHEX(stopAttrs[1]).toLowerCase(), offset: offset} );271 }272 fill.stops = stops;273 }274 break;275 case "radial" :276 stopStrings = fillNode.colors;277 if(stopStrings)278 {279 stops = [];280 if(stopStrings.value)281 {282 stopStrings = stopStrings.value;283 }284 stopStrings = stopStrings.split(";");285 len = stops.length;286 for(; i < len; i = i + 1)287 {288 stopAttrs = stopStrings[i].split(" ");289 offset = stopAttrs[0];290 if(offset.indexOf("f") > -1)291 {292 offset = 100 * parseFloat(offset)/65535293 offset = Math.round(offset)/100;294 }295 stops.push( {color: TOHEX(stopAttrs[1]).toLowerCase(), offset: offset} );296 }297 fill.stops = stops;298 }299 break;300 }301 fill.type = type;302 return fill;303 },304 getDimensions: function(shape)305 {306 var node = this._node,307 w = parseFloat(node.getComputedStyle("width")),308 h = parseFloat(node.getComputedStyle("height"));309 return {310 width: w,311 height: h312 };313 }314 },315 canvas: {316 getStroke: function()317 {318 var context = this._node.getDOMNode().getContext("2d"),319 color = context.strokeStyle,320 weight = context.lineWidth;321 if(color.indexOf("RGBA") > -1 || color.indexOf("rgba") > -1)322 {323 color = color.toLowerCase();324 color = color.replace(/, /g, ",");325 }326 else327 {328 color = toRGBA(TOHEX(color));329 }330 return {331 color: color,332 weight: weight333 }334 },335 getFill: function()336 {337 var context = this._node.getDOMNode().getContext("2d"),338 color = context.fillStyle;339 if(color.indexOf("RGBA") > -1 || color.indexOf("rgba") > -1)340 {341 color = color.toLowerCase();342 color = color.replace(/, /g, ",");343 }344 else345 {346 color = toRGBA(TOHEX(color));347 }348 return {349 color: color350 }351 },352 getDimensions: function(shape)353 {354 var node = this._node,355 w = parseFloat(node.get("width")),356 h = parseFloat(node.get("height")),357 wt = this.getStroke().weight || 0;358 if(wt) {359 wt = wt * 2;360 w = w - wt;361 h = h - wt;362 }363 return {364 width: w,365 height: h366 };367 }368 }369 };370 function ShapeNode(){}371 ShapeNode.prototype = IMPLEMENTATION[ENGINE];372 ShapeNode.one = function(node)373 {374 var instance = ShapeNode._instance;375 if(!instance)376 {377 instance = new Y.ShapeNode();378 ShapeNode._instance = instance;379 }380 instance._node = node;381 return instance;382 };383 Y.ShapeNode = ShapeNode;384 suite.add(new Y.Test.Case({385 name: "Graphics Path Tests",386 testGraphicsLoaded : function()387 {388 var shapes = Y.all(SHAPE),389 paths = Y.all(ROUNDEDRECT);390 Y.Assert.areEqual(1, shapes.size(), "There should be 1 shape.");391 Y.Assert.areEqual(1, paths.size(), "There should be 1 roundedRect instance.");392 },393 testCustomShape: function()394 {395 var roundRect = Y.all(ROUNDEDRECT).shift(),396 roundRectWidth = 300,397 roundRectHeight = 200,398 roundRectDimensions = Y.ShapeNode.one(roundRect).getDimensions("path"),399 defaultStops = [400 {color: "#9aa9bb", offset: 0, opacity: 1},401 {color: "#eeefff", offset: 0.4, opacity: 1},402 {color: "#00000f", offset: 0.8, opacity: 1},403 {color: "#9aa9bb", offset: 1, opacity: 1}404 ],405 defaultStop,406 i = 0,407 len = defaultStops.length,408 fill,409 stops, 410 key,411 stop;412 //Need to add logic for parsing size of path element in svg413 if(ENGINE != "svg")414 {415 Y.Assert.areEqual(roundRectWidth, roundRectDimensions.width, "The width of the roundRect should be " + roundRectWidth + ".");416 Y.Assert.areEqual(roundRectHeight, roundRectDimensions.height, "The height of the roundRect should be " + roundRectHeight + ".");417 }418 if(ENGINE != "canvas")419 {420 fill = Y.ShapeNode.one(roundRect).getFill();421 stops = fill.stops;422 for(; i < len; i = i + 1)423 {424 stop = stops[i];425 defaultStop = defaultStops[i];426 if(stop && defaultStops)427 {428 for(key in stop)429 {430 if(stop.hasOwnProperty(key))431 {432 Y.Assert.areEqual(defaultStop[key], stop[key], "The " + key + " value should be " + defaultStop[key] + ".");433 }434 }435 }436 }437 }438 }439 }));440 Y.Test.Runner.add(suite);...

Full Screen

Full Screen

graphics-violin-tests.js

Source:graphics-violin-tests.js Github

copy

Full Screen

1YUI.add('graphics-violin-tests', function(Y) {2 var suite = new Y.Test.Suite('graphics-violin-tests example test suite'),3 _getClassName = Y.ClassNameManager.getClassName,4 SHAPE,5 ENGINE = "vml",6 ELLIPSE,7 RECT,8 PATH,9 DOCUMENT = Y.config.doc,10 canvas = DOCUMENT && DOCUMENT.createElement("canvas"),11 graphicTests,12 svgTests,13 canvasTests,14 vmlTests,15 TORGB = Y.Color.toRGB,16 TOHEX = Y.Color.toHex,17 toRGBA = function(val, alpha) {18 alpha = Y.Lang.isNumber(alpha) ? alpha : 1;19 if (!Y.Color.re_RGB.test(val)) {20 val = TOHEX(val);21 }22 if(Y.Color.re_hex.exec(val)) {23 val = 'rgba(' + [24 parseInt(RegExp.$1, 16),25 parseInt(RegExp.$2, 16),26 parseInt(RegExp.$3, 16)27 ].join(',') + ',' + alpha + ')';28 }29 return val;30 },31 IMPLEMENTATION;32 if(DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"))33 {34 ENGINE = "svg";35 }36 else if(canvas && canvas.getContext && canvas.getContext("2d"))37 {38 ENGINE = "canvas";39 }40 SHAPE = "." + _getClassName(ENGINE + "Shape");41 ELLIPSE = "." + _getClassName(ENGINE + "Ellipse");42 RECT = "." + _getClassName(ENGINE + "Rect");43 PATH = "." + _getClassName(ENGINE + "Path");44 IMPLEMENTATION = {45 svg: {46 getStroke: function()47 {48 var node = this._node,49 color = node.getAttribute("stroke"),50 weight = node.getAttribute("stroke-width"),51 opacity = node.getAttribute("stroke-opacity");52 color = toRGBA(TOHEX(color), opacity);53 return {54 color: color,55 weight: weight56 }57 },58 getFill: function()59 {60 var node = this._node,61 fillNode,62 stopNodes,63 len,64 i = 0,65 stops,66 stop,67 stopNode,68 offset,69 gradientIndex,70 tagName,71 type,72 color = node.getAttribute("fill"),73 opacity = node.getAttribute("fill-opacity"),74 fill = {};75 if(color.indexOf("url") > -1)76 {77 color = color.slice(color.indexOf("#"), color.lastIndexOf(")"));78 fillNode = Y.one(color);79 if(fillNode)80 {81 tagName = fillNode.get("tagName");82 if(tagName)83 {84 gradientIndex = tagName.indexOf("Gradient");85 if(gradientIndex > -1)86 {87 type = tagName.slice(tagName.indexOf(":") + 1, gradientIndex);88 if(type == "linear")89 {90 //add rotation logic91 }92 else if(type == "radial")93 {94 //add cx,cy,fx,fy,r logic95 }96 }97 fill.type = type;98 }99 stopNodes = fillNode.get("children");100 stopNodes = stopNodes ? stopNodes.filter("stop") : null;101 if(stopNodes)102 { 103 len = stopNodes.size();104 stops = [];105 for(; i < len; i = i + 1)106 {107 stopNode = stopNodes.item(i);108 stop = {};109 if(stopNode.hasAttribute("stop-color"))110 {111 stop.color = TOHEX(stopNode.getAttribute("stop-color")).toLowerCase();112 }113 if(stopNode.hasAttribute("offset"))114 {115 offset = stopNode.getAttribute("offset");116 if(offset.indexOf("%") > -1)117 {118 offset = parseFloat(offset)/100;119 }120 else121 {122 offset = 1;123 }124 stop.offset = offset;125 }126 if(stopNode.hasAttribute("stop-opacity"))127 {128 stop.opacity = stopNode.getAttribute("stop-opacity");129 }130 stops.push(stop);131 }132 fill.stops = stops;133 }134 }135 }136 else137 {138 color = toRGBA(TOHEX(color), opacity);139 fill.color = color;140 fill.type = "solid";141 }142 return fill;143 },144 getDimensions: function(shape)145 {146 var w,147 h,148 node = this._node;149 switch(shape)150 {151 case "circle" :152 w = node.getAttribute("r") * 2;153 h = w;154 break;155 case "ellipse" :156 w = parseFloat(node.getAttribute("rx")) * 2;157 h = parseFloat(node.getAttribute("ry")) * 2;158 break;159 default :160 w = node.get("width");161 h = node.get("height");162 break;163 }164 return {165 width: w,166 height: h167 }168 }169 },170 vml: {171 getStroke: function()172 {173 var node = Y.one(this._node),174 nodelist = node.get("children"),175 strokeNode,176 color,177 weight,178 opacity;179 if(nodelist)180 {181 strokeNode = nodelist.filter('stroke');182 if(strokeNode.size() > 0)183 {184 strokeNode = strokeNode.shift().getDOMNode();185 }186 }187 color = node.get("strokecolor");188 weight = node.get("strokeweight");189 opacity = strokeNode ? strokeNode.opacity : 1;190 if(!Y.Lang.isNumber(opacity))191 {192 opacity = 1;193 }194 if(color.value)195 {196 color = color.value;197 }198 color = toRGBA(TOHEX(color), parseFloat(opacity));199 weight = Math.round(weight * (96/72));200 return {201 color: color,202 weight: weight203 }204 },205 getFill: function()206 {207 var node = this._node,208 nodelist = Y.one(node).get("children"),209 type,210 fillNode,211 color,212 offset,213 stops,214 stopAttrs,215 stopStrings,216 opacity,217 i = 0,218 len,219 fill = {};220 if(nodelist)221 {222 fillNode = nodelist.filter("fill");223 if(fillNode.size() > 0)224 {225 fillNode = fillNode.shift().getDOMNode();226 }227 type = fillNode.type || "solid";228 if(type == "gradient")229 {230 type = "linear";231 }232 else if(type == "gradientRadial")233 {234 type = "radial";235 }236 }237 else238 {239 type = "solid";240 }241 switch(type)242 {243 case "solid" :244 color = node.get("fillcolor");245 opacity = fillNode ? fillNode.opacity : 1;246 if(color.value)247 {248 color = color.value;249 }250 color = toRGBA(TOHEX(color), parseFloat(opacity)); 251 fill.color = color;252 break;253 case "linear" :254 stopStrings = fillNode.colors;255 if(stopStrings)256 {257 stops = [];258 if(stopStrings.value)259 {260 stopStrings = stopStrings.value;261 }262 stopStrings = stopStrings.split(";");263 len = stops.length;264 for(; i < len; i = i + 1)265 {266 stopAttrs = stopStrings[i].split(" ");267 offset = stopAttrs[0];268 if(offset.indexOf("f") > -1)269 {270 offset = 100 * parseFloat(offset)/65535271 offset = Math.round(offset)/100;272 }273 stops.push( {color: TOHEX(stopAttrs[1]).toLowerCase(), offset: offset} );274 }275 fill.stops = stops;276 }277 break;278 case "radial" :279 stopStrings = fillNode.colors;280 if(stopStrings)281 {282 stops = [];283 if(stopStrings.value)284 {285 stopStrings = stopStrings.value;286 }287 stopStrings = stopStrings.split(";");288 len = stops.length;289 for(; i < len; i = i + 1)290 {291 stopAttrs = stopStrings[i].split(" ");292 offset = stopAttrs[0];293 if(offset.indexOf("f") > -1)294 {295 offset = 100 * parseFloat(offset)/65535296 offset = Math.round(offset)/100;297 }298 stops.push( {color: TOHEX(stopAttrs[1]).toLowerCase(), offset: offset} );299 }300 fill.stops = stops;301 }302 break;303 }304 fill.type = type;305 return fill;306 },307 getDimensions: function(shape)308 {309 var node = this._node,310 w = parseFloat(node.getComputedStyle("width")),311 h = parseFloat(node.getComputedStyle("height"));312 return {313 width: w,314 height: h315 };316 }317 },318 canvas: {319 getStroke: function()320 {321 var context = this._node.getDOMNode().getContext("2d"),322 color = context.strokeStyle,323 weight = context.lineWidth;324 if(color.indexOf("RGBA") > -1 || color.indexOf("rgba") > -1)325 {326 color = color.toLowerCase();327 color = color.replace(/, /g, ",");328 }329 else330 {331 color = toRGBA(TOHEX(color));332 }333 return {334 color: color,335 weight: weight336 }337 },338 getFill: function()339 {340 var context = this._node.getDOMNode().getContext("2d"),341 color = context.fillStyle;342 if(color.indexOf("RGBA") > -1 || color.indexOf("rgba") > -1)343 {344 color = color.toLowerCase();345 color = color.replace(/, /g, ",");346 }347 else348 {349 color = toRGBA(TOHEX(color));350 }351 return {352 color: color353 }354 },355 getDimensions: function(shape)356 {357 var node = this._node,358 w = parseFloat(node.get("width")),359 h = parseFloat(node.get("height")),360 wt = this.getStroke().weight || 0;361 if(wt) {362 wt = wt * 2;363 w = w - wt;364 h = h - wt;365 }366 return {367 width: w,368 height: h369 };370 }371 }372 };373 function ShapeNode(){}374 ShapeNode.prototype = IMPLEMENTATION[ENGINE];375 ShapeNode.one = function(node)376 {377 var instance = ShapeNode._instance;378 if(!instance)379 {380 instance = new Y.ShapeNode();381 ShapeNode._instance = instance;382 }383 instance._node = node;384 return instance;385 };386 Y.ShapeNode = ShapeNode;387 suite.add(new Y.Test.Case({388 name: "Graphics Violin Tests",389 testGraphicsLoaded : function()390 {391 var shapes = Y.all(SHAPE),392 ellipses = Y.all(ELLIPSE),393 rects = Y.all(RECT),394 paths = Y.all(PATH),395 ie = Y.UA.ie,396 numberofpaths = ie && ie < 9 ? 19 : 20,397 totalshapes = numberofpaths + 8;398 Y.Assert.areEqual(totalshapes, shapes.size(), "There should be " + totalshapes + " shape.");399 Y.Assert.areEqual(7, ellipses.size(), "There should be 7 Ellipse instance.");400 Y.Assert.areEqual(1, rects.size(), "There should be 3 Rect instances.");401 Y.Assert.areEqual(numberofpaths, paths.size(), "There should be " + numberofpaths + " Path instances.");402 }403 }));404 Y.Test.Runner.add(suite);...

Full Screen

Full Screen

graphics-muddyglass-tests.js

Source:graphics-muddyglass-tests.js Github

copy

Full Screen

1YUI.add('graphics-muddyglass-tests', function(Y) {2 var suite = new Y.Test.Suite('graphics-muddyglass-tests example test suite'),3 _getClassName = Y.ClassNameManager.getClassName,4 SHAPE,5 ENGINE = "vml",6 ELLIPSE,7 RECT,8 DOCUMENT = Y.config.doc,9 canvas = DOCUMENT && DOCUMENT.createElement("canvas"),10 graphicTests,11 svgTests,12 canvasTests,13 vmlTests,14 TORGB = Y.Color.toRGB,15 TOHEX = Y.Color.toHex,16 toRGBA = function(val, alpha) {17 alpha = Y.Lang.isNumber(alpha) ? alpha : 1;18 if (!Y.Color.re_RGB.test(val)) {19 val = TOHEX(val);20 }21 if(Y.Color.re_hex.exec(val)) {22 val = 'rgba(' + [23 parseInt(RegExp.$1, 16),24 parseInt(RegExp.$2, 16),25 parseInt(RegExp.$3, 16)26 ].join(',') + ',' + alpha + ')';27 }28 return val;29 },30 IMPLEMENTATION;31 if(DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"))32 {33 ENGINE = "svg";34 }35 else if(canvas && canvas.getContext && canvas.getContext("2d"))36 {37 ENGINE = "canvas";38 }39 SHAPE = "." + _getClassName(ENGINE + "Shape");40 ELLIPSE = "." + _getClassName(ENGINE + "Ellipse");41 RECT = "." + _getClassName(ENGINE + "Rect");42 IMPLEMENTATION = {43 svg: {44 getStroke: function()45 {46 var node = this._node,47 color = node.getAttribute("stroke"),48 weight = node.getAttribute("stroke-width"),49 opacity = node.getAttribute("stroke-opacity");50 color = toRGBA(TOHEX(color), opacity);51 return {52 color: color,53 weight: weight54 }55 },56 getFill: function()57 {58 var node = this._node,59 fillNode,60 stopNodes,61 len,62 i = 0,63 stops,64 stop,65 stopNode,66 offset,67 gradientIndex,68 tagName,69 type,70 color = node.getAttribute("fill"),71 opacity = node.getAttribute("fill-opacity"),72 fill = {};73 if(color.indexOf("url") > -1)74 {75 color = color.slice(color.indexOf("#"), color.lastIndexOf(")"));76 fillNode = Y.one(color);77 if(fillNode)78 {79 tagName = fillNode.get("tagName");80 if(tagName)81 {82 gradientIndex = tagName.indexOf("Gradient");83 if(gradientIndex > -1)84 {85 type = tagName.slice(tagName.indexOf(":") + 1, gradientIndex);86 if(type == "linear")87 {88 //add rotation logic89 }90 else if(type == "radial")91 {92 //add cx,cy,fx,fy,r logic93 }94 }95 fill.type = type;96 }97 stopNodes = fillNode.get("children");98 stopNodes = stopNodes ? stopNodes.filter("stop") : null;99 if(stopNodes)100 { 101 len = stopNodes.size();102 stops = [];103 for(; i < len; i = i + 1)104 {105 stopNode = stopNodes.item(i);106 stop = {};107 if(stopNode.hasAttribute("stop-color"))108 {109 stop.color = TOHEX(stopNode.getAttribute("stop-color")).toLowerCase();110 }111 if(stopNode.hasAttribute("offset"))112 {113 offset = stopNode.getAttribute("offset");114 if(offset.indexOf("%") > -1)115 {116 offset = parseFloat(offset)/100;117 }118 else119 {120 offset = 1;121 }122 stop.offset = offset;123 }124 if(stopNode.hasAttribute("stop-opacity"))125 {126 stop.opacity = stopNode.getAttribute("stop-opacity");127 }128 stops.push(stop);129 }130 fill.stops = stops;131 }132 }133 }134 else135 {136 color = toRGBA(TOHEX(color), opacity);137 fill.color = color;138 fill.type = "solid";139 }140 return fill;141 },142 getDimensions: function(shape)143 {144 var w,145 h,146 node = this._node;147 switch(shape)148 {149 case "circle" :150 w = node.getAttribute("r") * 2;151 h = w;152 break;153 case "ellipse" :154 w = parseFloat(node.getAttribute("rx")) * 2;155 h = parseFloat(node.getAttribute("ry")) * 2;156 break;157 default :158 w = node.get("width");159 h = node.get("height");160 break;161 }162 return {163 width: w,164 height: h165 }166 }167 },168 vml: {169 getStroke: function()170 {171 var node = Y.one(this._node),172 nodelist = node.get("children"),173 strokeNode,174 color,175 weight,176 opacity;177 if(nodelist)178 {179 strokeNode = nodelist.filter('stroke');180 if(strokeNode.size() > 0)181 {182 strokeNode = strokeNode.shift().getDOMNode();183 }184 }185 color = node.get("strokecolor");186 weight = node.get("strokeweight");187 opacity = strokeNode ? strokeNode.opacity : 1;188 if(!Y.Lang.isNumber(opacity))189 {190 opacity = 1;191 }192 if(color.value)193 {194 color = color.value;195 }196 color = toRGBA(TOHEX(color), parseFloat(opacity));197 weight = Math.round(weight * (96/72));198 return {199 color: color,200 weight: weight201 }202 },203 getFill: function()204 {205 var node = this._node,206 nodelist = Y.one(node).get("children"),207 type,208 fillNode,209 color,210 offset,211 stops,212 stopAttrs,213 stopStrings,214 opacity,215 i = 0,216 len,217 fill = {};218 if(nodelist)219 {220 fillNode = nodelist.filter("fill");221 if(fillNode.size() > 0)222 {223 fillNode = fillNode.shift().getDOMNode();224 }225 type = fillNode.type || "solid";226 if(type == "gradient")227 {228 type = "linear";229 }230 else if(type == "gradientRadial")231 {232 type = "radial";233 }234 }235 else236 {237 type = "solid";238 }239 switch(type)240 {241 case "solid" :242 color = node.get("fillcolor");243 opacity = fillNode ? fillNode.opacity : 1;244 if(color.value)245 {246 color = color.value;247 }248 color = toRGBA(TOHEX(color), parseFloat(opacity)); 249 fill.color = color;250 break;251 case "linear" :252 stopStrings = fillNode.colors;253 if(stopStrings)254 {255 stops = [];256 if(stopStrings.value)257 {258 stopStrings = stopStrings.value;259 }260 stopStrings = stopStrings.split(";");261 len = stops.length;262 for(; i < len; i = i + 1)263 {264 stopAttrs = stopStrings[i].split(" ");265 offset = stopAttrs[0];266 if(offset.indexOf("f") > -1)267 {268 offset = 100 * parseFloat(offset)/65535269 offset = Math.round(offset)/100;270 }271 stops.push( {color: TOHEX(stopAttrs[1]).toLowerCase(), offset: offset} );272 }273 fill.stops = stops;274 }275 break;276 case "radial" :277 stopStrings = fillNode.colors;278 if(stopStrings)279 {280 stops = [];281 if(stopStrings.value)282 {283 stopStrings = stopStrings.value;284 }285 stopStrings = stopStrings.split(";");286 len = stops.length;287 for(; i < len; i = i + 1)288 {289 stopAttrs = stopStrings[i].split(" ");290 offset = stopAttrs[0];291 if(offset.indexOf("f") > -1)292 {293 offset = 100 * parseFloat(offset)/65535294 offset = Math.round(offset)/100;295 }296 stops.push( {color: TOHEX(stopAttrs[1]).toLowerCase(), offset: offset} );297 }298 fill.stops = stops;299 }300 break;301 }302 fill.type = type;303 return fill;304 },305 getDimensions: function(shape)306 {307 var node = this._node,308 w = parseFloat(node.getComputedStyle("width")),309 h = parseFloat(node.getComputedStyle("height"));310 return {311 width: w,312 height: h313 };314 }315 },316 canvas: {317 getStroke: function()318 {319 var context = this._node.getDOMNode().getContext("2d"),320 color = context.strokeStyle,321 weight = context.lineWidth;322 if(color.indexOf("RGBA") > -1 || color.indexOf("rgba") > -1)323 {324 color = color.toLowerCase();325 color = color.replace(/, /g, ",");326 }327 else328 {329 color = toRGBA(TOHEX(color));330 }331 return {332 color: color,333 weight: weight334 }335 },336 getFill: function()337 {338 var context = this._node.getDOMNode().getContext("2d"),339 color = context.fillStyle;340 if(color.indexOf("RGBA") > -1 || color.indexOf("rgba") > -1)341 {342 color = color.toLowerCase();343 color = color.replace(/, /g, ",");344 }345 else346 {347 color = toRGBA(TOHEX(color));348 }349 return {350 color: color351 }352 },353 getDimensions: function(shape)354 {355 var node = this._node,356 w = parseFloat(node.get("width")),357 h = parseFloat(node.get("height")),358 wt = this.getStroke().weight || 0;359 if(wt) {360 wt = wt * 2;361 w = w - wt;362 h = h - wt;363 }364 return {365 width: w,366 height: h367 };368 }369 }370 };371 function ShapeNode(){}372 ShapeNode.prototype = IMPLEMENTATION[ENGINE];373 ShapeNode.one = function(node)374 {375 var instance = ShapeNode._instance;376 if(!instance)377 {378 instance = new Y.ShapeNode();379 ShapeNode._instance = instance;380 }381 instance._node = node;382 return instance;383 };384 Y.ShapeNode = ShapeNode;385 suite.add(new Y.Test.Case({386 name: "Graphics Transparent Glass Tests",387 testGraphicsLoaded : function()388 {389 var shapes = Y.all(SHAPE),390 ellipses = Y.all(ELLIPSE),391 rects = Y.all(RECT);392 Y.Assert.areEqual(4, shapes.size(), "There should be 1 shape.");393 Y.Assert.areEqual(1, ellipses.size(), "There should be 1 Ellipse instance.");394 Y.Assert.areEqual(3, rects.size(), "There should be 3 Rect instances.");395 }396 }));397 Y.Test.Runner.add(suite);...

Full Screen

Full Screen

Stemmer.gs

Source:Stemmer.gs Github

copy

Full Screen

1/**2* MIT3* https://github.com/words/lancaster-stemmer/blob/master/LICENSE4*/5var Stemmer = (function (ns) {6 7 var STOP = -1;8 var INTACT = 0;9 var CONTINUE = 1;10 var PROTECT = 2;11 var VOWELS = /[aeiouy]/;12 var rules;13 14 const init = function () {15 16 rules = {17 a: [18 {match: 'ia', replacement: '', type: INTACT},19 {match: 'a', replacement: '', type: INTACT}20 ],21 b: [{match: 'bb', replacement: 'b', type: STOP}],22 c: [23 {match: 'ytic', replacement: 'ys', type: STOP},24 {match: 'ic', replacement: '', type: CONTINUE},25 {match: 'nc', replacement: 'nt', type: CONTINUE}26 ],27 d: [28 {match: 'dd', replacement: 'd', type: STOP},29 {match: 'ied', replacement: 'y', type: CONTINUE},30 {match: 'ceed', replacement: 'cess', type: STOP},31 {match: 'eed', replacement: 'ee', type: STOP},32 {match: 'ed', replacement: '', type: CONTINUE},33 {match: 'hood', replacement: '', type: CONTINUE}34 ],35 e: [{match: 'e', replacement: '', type: CONTINUE}],36 f: [37 {match: 'lief', replacement: 'liev', type: STOP},38 {match: 'if', replacement: '', type: CONTINUE}39 ],40 g: [41 {match: 'ing', replacement: '', type: CONTINUE},42 {match: 'iag', replacement: 'y', type: STOP},43 {match: 'ag', replacement: '', type: CONTINUE},44 {match: 'gg', replacement: 'g', type: STOP}45 ],46 h: [47 {match: 'th', replacement: '', type: INTACT},48 {match: 'guish', replacement: 'ct', type: STOP},49 {match: 'ish', replacement: '', type: CONTINUE}50 ],51 i: [52 {match: 'i', replacement: '', type: INTACT},53 {match: 'i', replacement: 'y', type: CONTINUE}54 ],55 j: [56 {match: 'ij', replacement: 'id', type: STOP},57 {match: 'fuj', replacement: 'fus', type: STOP},58 {match: 'uj', replacement: 'ud', type: STOP},59 {match: 'oj', replacement: 'od', type: STOP},60 {match: 'hej', replacement: 'her', type: STOP},61 {match: 'verj', replacement: 'vert', type: STOP},62 {match: 'misj', replacement: 'mit', type: STOP},63 {match: 'nj', replacement: 'nd', type: STOP},64 {match: 'j', replacement: 's', type: STOP}65 ],66 l: [67 {match: 'ifiabl', replacement: '', type: STOP},68 {match: 'iabl', replacement: 'y', type: STOP},69 {match: 'abl', replacement: '', type: CONTINUE},70 {match: 'ibl', replacement: '', type: STOP},71 {match: 'bil', replacement: 'bl', type: CONTINUE},72 {match: 'cl', replacement: 'c', type: STOP},73 {match: 'iful', replacement: 'y', type: STOP},74 {match: 'ful', replacement: '', type: CONTINUE},75 {match: 'ul', replacement: '', type: STOP},76 {match: 'ial', replacement: '', type: CONTINUE},77 {match: 'ual', replacement: '', type: CONTINUE},78 {match: 'al', replacement: '', type: CONTINUE},79 {match: 'll', replacement: 'l', type: STOP}80 ],81 m: [82 {match: 'ium', replacement: '', type: STOP},83 {match: 'um', replacement: '', type: INTACT},84 {match: 'ism', replacement: '', type: CONTINUE},85 {match: 'mm', replacement: 'm', type: STOP}86 ],87 n: [88 {match: 'sion', replacement: 'j', type: CONTINUE},89 {match: 'xion', replacement: 'ct', type: STOP},90 {match: 'ion', replacement: '', type: CONTINUE},91 {match: 'ian', replacement: '', type: CONTINUE},92 {match: 'an', replacement: '', type: CONTINUE},93 {match: 'een', replacement: '', type: PROTECT},94 {match: 'en', replacement: '', type: CONTINUE},95 {match: 'nn', replacement: 'n', type: STOP}96 ],97 p: [98 {match: 'ship', replacement: '', type: CONTINUE},99 {match: 'pp', replacement: 'p', type: STOP}100 ],101 r: [102 {match: 'er', replacement: '', type: CONTINUE},103 {match: 'ear', replacement: '', type: PROTECT},104 {match: 'ar', replacement: '', type: STOP},105 {match: 'ior', replacement: '', type: CONTINUE},106 {match: 'or', replacement: '', type: CONTINUE},107 {match: 'ur', replacement: '', type: CONTINUE},108 {match: 'rr', replacement: 'r', type: STOP},109 {match: 'tr', replacement: 't', type: CONTINUE},110 {match: 'ier', replacement: 'y', type: CONTINUE}111 ],112 s: [113 {match: 'ies', replacement: 'y', type: CONTINUE},114 {match: 'sis', replacement: 's', type: STOP},115 {match: 'is', replacement: '', type: CONTINUE},116 {match: 'ness', replacement: '', type: CONTINUE},117 {match: 'ss', replacement: '', type: PROTECT},118 {match: 'ous', replacement: '', type: CONTINUE},119 {match: 'us', replacement: '', type: INTACT},120 {match: 's', replacement: '', type: CONTINUE},121 {match: 's', replacement: '', type: STOP}122 ],123 t: [124 {match: 'plicat', replacement: 'ply', type: STOP},125 {match: 'at', replacement: '', type: CONTINUE},126 {match: 'ment', replacement: '', type: CONTINUE},127 {match: 'ent', replacement: '', type: CONTINUE},128 {match: 'ant', replacement: '', type: CONTINUE},129 {match: 'ript', replacement: 'rib', type: STOP},130 {match: 'orpt', replacement: 'orb', type: STOP},131 {match: 'duct', replacement: 'duc', type: STOP},132 {match: 'sumpt', replacement: 'sum', type: STOP},133 {match: 'cept', replacement: 'ceiv', type: STOP},134 {match: 'olut', replacement: 'olv', type: STOP},135 {match: 'sist', replacement: '', type: PROTECT},136 {match: 'ist', replacement: '', type: CONTINUE},137 {match: 'tt', replacement: 't', type: STOP}138 ],139 u: [140 {match: 'iqu', replacement: '', type: STOP},141 {match: 'ogu', replacement: 'og', type: STOP}142 ],143 v: [144 {match: 'siv', replacement: 'j', type: CONTINUE},145 {match: 'eiv', replacement: '', type: PROTECT},146 {match: 'iv', replacement: '', type: CONTINUE}147 ],148 y: [149 {match: 'bly', replacement: 'bl', type: CONTINUE},150 {match: 'ily', replacement: 'y', type: CONTINUE},151 {match: 'ply', replacement: '', type: PROTECT},152 {match: 'ly', replacement: '', type: CONTINUE},153 {match: 'ogy', replacement: 'og', type: STOP},154 {match: 'phy', replacement: 'ph', type: STOP},155 {match: 'omy', replacement: 'om', type: STOP},156 {match: 'opy', replacement: 'op', type: STOP},157 {match: 'ity', replacement: '', type: CONTINUE},158 {match: 'ety', replacement: '', type: CONTINUE},159 {match: 'lty', replacement: 'l', type: STOP},160 {match: 'istry', replacement: '', type: STOP},161 {match: 'ary', replacement: '', type: CONTINUE},162 {match: 'ory', replacement: '', type: CONTINUE},163 {match: 'ify', replacement: '', type: STOP},164 {match: 'ncy', replacement: 'nt', type: CONTINUE},165 {match: 'acy', replacement: '', type: CONTINUE}166 ],167 z: [168 {match: 'iz', replacement: '', type: CONTINUE},169 {match: 'yz', replacement: 'ys', type: STOP}170 ]171 };172 };173 174 ns.getStem = function (value) {175 return applyRules(String(value).toLowerCase(), true);176 }177 178 function applyRules(value, isIntact) {179 // first time used180 if (!rules) init();181 var ruleset = rules[value.charAt(value.length - 1)];182 var breakpoint;183 var index;184 var length;185 var rule;186 var next;187 188 if (!ruleset) {189 return value;190 }191 192 index = -1;193 length = ruleset.length;194 195 while (++index < length) {196 rule = ruleset[index];197 198 if (!isIntact && rule.type === INTACT) {199 continue;200 }201 202 breakpoint = value.length - rule.match.length;203 204 if (breakpoint < 0 || value.substr(breakpoint) !== rule.match) {205 continue;206 }207 208 if (rule.type === PROTECT) {209 return value;210 }211 212 next = value.substr(0, breakpoint) + rule.replacement;213 214 if (!acceptable(next)) {215 continue;216 }217 218 if (rule.type === CONTINUE) {219 return applyRules(next, false);220 }221 222 return next;223 }224 225 return value;226 }227 228 /* Detect if a value is acceptable to return, or should229 * be stemmed further. */230 function acceptable(value) {231 return VOWELS.test(value.charAt(0)) ?232 value.length > 1 : value.length > 2 && VOWELS.test(value);233 }234 return ns;...

Full Screen

Full Screen

jsintro.js

Source:jsintro.js Github

copy

Full Screen

...7 $('.right .txt').css({ 'opacity': '0' });8 $('.left .txt').css({ 'opacity': '0' });9 //value¿¡ ¸¶¿ì½º¿À¹ö½Ã txt¶ß°Ô10 $('.left').mouseover(function () {11 $('.right .txt').stop(true).animate({ 'opacity': '1' }, 500, 'linear');12 $('.right .title').stop(true).animate({ 'opacity': '0' }, 500, 'linear');13 });14 $('.left').mouseout(function () {15 $('.right .txt').stop(true).animate({ 'opacity': '0' }, 500, 'linear');16 $('.right .title').stop(true).animate({ 'opacity': '1' }, 500, 'linear');17 });18 //mission¿¡ ¸¶¿ì½º¿À¹ö½Ã txt¶ß°Ô19 $('.right').mouseover(function () {20 $('.left .txt').stop(true).animate({ 'opacity': '1' }, 500, 'linear');21 $('.left .title').stop(true).animate({ 'opacity': '0' }, 500, 'linear');22 });23 $('.right').mouseout(function () {24 $('.left .txt').stop(true).animate({ 'opacity': '0' }, 500, 'linear');25 $('.left .title').stop(true).animate({ 'opacity': '1' }, 500, 'linear');26 });27 //°¡Ä¡ ´­·¶À»¶§28 $('.mission_btn').click(function(){29 $('.mission_btn').css({ 'font-size': '18px', 'font-weight': '400' });30 $('.space_btn').css({ 'font-size': '16px', 'font-weight': '300' });31 $('#i1').show();32 $('#i2').hide();33 $('.bg').hide();34 $('.left .txt').hide();35 $('.right .txt').hide();36 });37 //Àü½Ã°ü ´­·¶À»¶§38 $('.space_btn').click(function () { 39 $('.mission_btn').css({ 'font-size': '16px', 'font-weight': '300' });40 $('.space_btn').css({ 'font-size': '18px', 'font-weight': '400' });41 $('#i1').hide();42 $('#i2').show();43 $('.bg').show();44 });45 //f2¸¦ ÃʱⰪÀ¸·Î46 $('#map1').show();47 $('#map2').hide();48 $('#i2 .floor .2f').stop(true).animate({49 'fontSize': '25px',50 'fontWeight': '500'51 });52 //2f´©¸£¸é map1ÀÌ ³ª¿À°ÔÇϱâ53 $('#i2 .floor .2f').click(function () {54 $('#map1').show();55 $('#map2').hide();56 $('#i2 .floor .2f').stop(true).animate({57 'fontSize': '25px',58 'fontWeight': '500'59 });60 $('#i2 .floor .3f').stop(true).animate({61 'fontSize': '18px',62 'fontWeight': '200'63 });64 });65 //3f´©¸£¸é map2ÀÌ ³ª¿À°ÔÇϱâ66 $('#i2 .floor .3f').click(function () {67 $('#map1').hide();68 $('#map2').show();69 $('#i2 .floor .2f').stop(true).animate({70 'fontSize': '18px',71 'fontWeight': '200'72 });73 $('#i2 .floor .3f').stop(true).animate({74 'fontSize': '25px',75 'fontWeight': '500'76 });77 });78 //map1 js79 // ºÐÈ«¿¡ ¸¶¿ì½º¿À¹ö½Ã ±ÛÀÚº¯È­80 $('#map1 .f1').mouseover(function () {81 $('#map1 .txt1').stop(true).animate({82 'backgroundColor': '#c18e5d',83 'color': '#fff'84 }, 300, 'linear'),85 $('#map1 .txt .txt1 h2').stop(true).animate({86 'fontSize': '22px',87 'color': '#fff'88 }, 300, 'linear');89 });90 $('#map1 .f1').mouseout(function () {91 $('#map1 .txt1').stop(true).animate({92 'backgroundColor': 'rgba(0, 0, 0, 0.00)',93 'color': '#000'94 }, 300, 'linear'),95 $('#map1 .txt .txt1 h2').stop(true).animate({96 'fontSize': '20px',97 'color': '#c18e5d'98 }, 300, 'linear');99 });100 // ¿¬µÎ¿¡ ¸¶¿ì½º¿À¹ö½Ã ±ÛÀÚº¯È­101 $('#map1 .f2').mouseover(function () {102 $('#map1 .txt2').stop(true).animate({103 'backgroundColor': '#9abd8f',104 'color': '#fff'105 }, 300, 'linear'),106 $('#map1 .txt .txt2 h2').stop(true).animate({107 'fontSize': '22px',108 'color': '#fff'109 }, 300, 'linear');110 });111 $('#map1 .f2').mouseout(function () {112 $('#map1 .txt2').stop(true).animate({113 'backgroundColor': 'rgba(0, 0, 0, 0.00)',114 'color': '#000'115 }, 300, 'linear'),116 $('#map1 .txt .txt2 h2').stop(true).animate({117 'fontSize': '20px',118 'color': '#9abd8f'119 }, 300, 'linear');120 });121 // ³ë·©¿¡ ¸¶¿ì½º¿À¹ö½Ã ±ÛÀÚº¯È­122 $('#map1 .f3').mouseover(function () {123 $('#map1 .txt3').stop(true).animate({124 'backgroundColor': '#dce66b',125 'color': '#fff'126 }, 300, 'linear'),127 $('#map1 .txt .txt3 h2').stop(true).animate({128 'fontSize': '22px',129 'color': '#fff'130 }, 300, 'linear');131 });132 $('#map1 .f3').mouseout(function () {133 $('#map1 .txt3').stop(true).animate({134 'backgroundColor': 'rgba(0, 0, 0, 0.00)',135 'color': '#000'136 }, 300, 'linear'),137 $('#map1 .txt .txt3 h2').stop(true).animate({138 'fontSize': '20px',139 'color': '#dce66b'140 }, 300, 'linear');141 });142 //map2 js143 // ÆĶû¿¡ ¸¶¿ì½º¿À¹ö½Ã ±ÛÀÚº¯È­144 $('#map2 .f1').mouseover(function () {145 $('#map2 .txt1').stop(true).animate({146 'backgroundColor': '#98b1bf',147 'color': '#fff'148 }, 300, 'linear'),149 $('#map2 .txt .txt1 h2').stop(true).animate({150 'fontSize': '22px',151 'color': '#fff'152 }, 300, 'linear');153 });154 $('#map2 .f1').mouseout(function () {155 $('#map2 .txt1').stop(true).animate({156 'backgroundColor': 'rgba(0, 0, 0, 0.00)',157 'color': '#000'158 }, 300, 'linear'),159 $('#map2 .txt .txt1 h2').stop(true).animate({160 'fontSize': '20px',161 'color': '#98b1bf'162 }, 300, 'linear');163 });164 // ³ë·©¿¡ ¸¶¿ì½º¿À¹ö½Ã ±ÛÀÚº¯È­165 $('#map2 .f2').mouseover(function () {166 $('#map2 .txt2').stop(true).animate({167 'backgroundColor': '#f1d882',168 'color': '#fff'169 }, 300, 'linear'),170 $('#map2 .txt .txt2 h2').stop(true).animate({171 'fontSize': '22px',172 'color': '#fff'173 }, 300, 'linear');174 });175 $('#map2 .f2').mouseout(function () {176 $('#map2 .txt2').stop(true).animate({177 'backgroundColor': 'rgba(0, 0, 0, 0.00)',178 'color': '#000'179 }, 300, 'linear'),180 $('#map2 .txt .txt2 h2').stop(true).animate({181 'fontSize': '20px',182 'color': '#f1d882'183 }, 300, 'linear');184 });185 // ¿¬µÎ¿¡ ¸¶¿ì½º¿À¹ö½Ã ±ÛÀÚº¯È­186 $('#map2 .f3').mouseover(function () {187 $('#map2 .txt3').stop(true).animate({188 'backgroundColor': '#a5c6b8',189 'color': '#fff'190 }, 300, 'linear'),191 $('#map2 .txt .txt3 h2').stop(true).animate({192 'fontSize': '22px',193 'color': '#fff'194 }, 300, 'linear');195 });196 $('#map2 .f3').mouseout(function () {197 $('#map2 .txt3').stop(true).animate({198 'backgroundColor': 'rgba(0, 0, 0, 0.00)',199 'color': '#000'200 }, 300, 'linear'),201 $('#map2 .txt .txt3 h2').stop(true).animate({202 'fontSize': '20px',203 'color': '#a5c6b8'204 }, 300, 'linear');205 });...

Full Screen

Full Screen

YEP_StopMapMovement.js

Source:YEP_StopMapMovement.js Github

copy

Full Screen

1//=============================================================================2// Yanfly Engine Plugins - Stop Map Movement3// YEP_StopMapMovement.js4//=============================================================================5var Imported = Imported || {};6Imported.YEP_StopMapMovement = true;7var Yanfly = Yanfly || {};8Yanfly.Stop = Yanfly.Stop || {};9//=============================================================================10 /*:11 * @plugindesc v1.01 A utility plugin to stop events from automatically12 * moving by themselves all across your map.13 * @author Yanfly Engine Plugins14 *15 * @param Stop During Events16 * @desc Stop automatic movement during events?17 * NO - false YES - true18 * @default true19 *20 * @param Stop During Message21 * @desc Stop automatic movement during message displaying?22 * NO - false YES - true23 * @default true24 *25 * @help26 * ============================================================================27 * Introduction28 * ============================================================================29 *30 * A feature that was removed from RPG Maker 2000 and RPG Maker 2003 was the31 * Stop Event Movement event. This event prevented events from automatically32 * moving by themselves, so they don't intrude on cutscenes, catch up to the33 * player during messages, etc.34 *35 * This plugin recreates that feature in the form of a plugin command for you36 * to use with RPG Maker MV!37 *38 * ============================================================================39 * Plugin Commands40 * ============================================================================41 *42 * You can use the following plugin commands to produce the following effects:43 *44 * Plugin Command45 *46 * StopEventMovement47 * Stops events from automatically moving by themselves. You can still move48 * events through movement routes set by your active event.49 *50 * AllowEventMovement51 * Allows events to move automatically by themselves again. If you have any52 * of the plugin parameters disabling events from moving during either events53 * or messages, this will not bypass it.54 *55 * StopPlayerMovement56 * Stops player from being able to move via input. You can still move the57 * player through movement routes set by your active event.58 *59 * AllowPlayerMovement60 * Allows player to move again via input.61 *62 * ============================================================================63 * Changelog64 * ============================================================================65 *66 * Version 1.01:67 * - Optimized updating performance to reduce lag on maps with many events.68 *69 * Version 1.00:70 * - Finished Plugin!71 */72//=============================================================================73//=============================================================================74// Parameter Variables75//=============================================================================76Yanfly.Parameters = PluginManager.parameters('YEP_StopMapMovement');77Yanfly.Param = Yanfly.Param || {};78Yanfly.Param.StopEvent = eval(String(Yanfly.Parameters['Stop During Events']));79Yanfly.Param.StopMsg = eval(String(Yanfly.Parameters['Stop During Message']));80//=============================================================================81// Game_Temp82//=============================================================================83Game_Temp.prototype.stopMapEventMovement = function() {84 this._stopMapEvents = true;85};86Game_Temp.prototype.stopMapPlayerMovement = function() {87 this._stopMapPlayer = true;88};89Game_Temp.prototype.allowMapEventMovement = function() {90 this._stopMapEvents = false;91};92Game_Temp.prototype.allowMapPlayerMovement = function() {93 this._stopMapPlayer = false;94};95Game_Temp.prototype.isStopMapEventMovement = function() {96 return this._stopMapEvents;97};98Game_Temp.prototype.isStopMapPlayerMovement = function() {99 return this._stopMapPlayer;100};101//=============================================================================102// Game_Player103//=============================================================================104Yanfly.Stop.Game_Player_canMove = Game_Player.prototype.canMove;105Game_Player.prototype.canMove = function() {106 if ($gameTemp.isStopMapPlayerMovement()) return false;107 return Yanfly.Stop.Game_Player_canMove.call(this);108};109//=============================================================================110// Game_Event111//=============================================================================112Yanfly.Stop.Game_Event_updateSelfMovement =113 Game_Event.prototype.updateSelfMovement;114Game_Event.prototype.updateSelfMovement = function() {115 if (this.preventSelfMovement()) return;116 Yanfly.Stop.Game_Event_updateSelfMovement.call(this);117};118Game_Event.prototype.preventSelfMovement = function() {119 if (this._moveType === 0) return true;120 if ($gameTemp.isStopMapEventMovement()) return true;121 if (Yanfly.Param.StopMsg && $gameMessage.isBusy()) return true;122 if (Yanfly.Param.StopEvent && $gameMap.isEventRunQuick()) return true;123 return false;124};125//=============================================================================126// Game_Map127//=============================================================================128Game_Map.prototype.isEventRunQuick = function() {129 return this._interpreter.isRunning() || this.isAnyEventStartingQuick();130};131Game_Map.prototype.isAnyEventStartingQuick = function() {132 var max = this._events.length;133 for (var i = 0; i < max; ++i) {134 var ev = this._events[i];135 if (ev && ev.isStarting()) return true;136 }137 return false;138};139//=============================================================================140// Game_Interpreter141//=============================================================================142Yanfly.Stop.Game_Interpreter_pluginCommand =143 Game_Interpreter.prototype.pluginCommand;144Game_Interpreter.prototype.pluginCommand = function(command, args) {145 Yanfly.Stop.Game_Interpreter_pluginCommand.call(this, command, args)146 if (command === 'StopEventMovement') $gameTemp.stopMapEventMovement();147 if (command === 'AllowEventMovement') $gameTemp.allowMapEventMovement();148 if (command === 'StopPlayerMovement') $gameTemp.stopMapPlayerMovement();149 if (command === 'AllowPlayerMovement') $gameTemp.allowMapPlayerMovement();150};151//=============================================================================152// End of File...

Full Screen

Full Screen

connectivity.js

Source:connectivity.js Github

copy

Full Screen

1var exec = require('cordova/exec'),2 connectivity = module.exports;3/**4 * This enum represents appfeel-connectivity plugin events5 * @const6 */7connectivity.EVENTS = {8 onReachabilityChanged : "appfeel.connectivity.onReachabilityChanged"9};10/**11 * This enum represents the observer that raised the change event.12 * @const13 */14connectivity.OBSERVER = {15 HOST: 'HOST',16 INTERNET: 'INTERNET',17 LOCALWIFI: 'LOCALWIFI'18}19/**20 * This enum represents connectivity interface. Use it to know the interface that changed his status returned by each event.21 * @const22 */23connectivity.INTERFACE = {24 DISCONNECTED: 'DISCONNECTED',25 WIFI: 'WIFI',26 WIMAX: 'WIMAX',27 ETHERNET: 'ETHERNET',28 MOBILE: 'MOBILE',29 UNDEFINED: 'UNDEFINED'30};31/**32 * Default host name for observeRemoteHostName33 * @const34 */35connectivity.DEFAULT_HOSTNAME = "www.google.com";36/**37 * Observes changes of connectivity to a given hostname.38 *39 * @param {!Object} hostName (Optional) Name of the host to observe. Default www.google.com40 * @param {Boolean} stopAllObservers (Optional) Stop any existing observer. Default false41 * @param {function()} successCallback (Optional) Callback on success42 * @param {function()} failureCallback (Optional) Callback on fail43 */44connectivity.observeRemoteHostName = function (hostName, stopAllObservers, successCallback, failureCallback) {45 if (typeof hostName === 'function') {46 failureCallback = stopAllObservers;47 successCallback = hostName;48 hostName = connectivity.DEFAULT_HOSTNAME;49 50 } else if (typeof stopAllObservers === 'function') {51 failureCallback = successCallback;52 successCallback = stopAllObservers;53 stopAllObservers = false;54 }55 56 hostName = hostName || "http://www.google.com";57 58 if (typeof hostName === 'string' && hostName.length > 0) {59 cordova.exec(successCallback, failureCallback, 'connectivity', 'observeRemoteHostName', [{60 hostName: hostName,61 stopAllObservers: stopAllObservers62 }]);63 64 } else {65 if (typeof failureCallback === 'function') {66 failureCallback('hostName must be a non zero string.')67 }68 }69};70/**71 * Observes changes of connectivity to a given ip v4.72 *73 * @param {!Object} ipv4 (Required) IP v4 to observe. Ex: 192.168.1.074 * @param {Boolean} stopAllObservers (Optional) Stop any existing observer. Default false75 * @param {function()} successCallback (Optional) Callback on success76 * @param {function()} failureCallback (Optional) Callback on fail77 */78connectivity.observeRemoteIPV4 = function (ipv4, stopAllObservers, successCallback, failureCallback) {79 if (typeof ipv4 === 'function') {80 failureCallback = stopAllObservers;81 successCallback = ipv4;82 ipv4 = undefined;83 84 } else if (typeof stopAllObservers === 'function') {85 failureCallback = successCallback;86 successCallback = stopAllObservers;87 stopAllObservers = false;88 }89 90 if (typeof ipv4 === 'string' && ipv4.length > 0) {91 cordova.exec(successCallback, failureCallback, 'connectivity', 'observeRemoteIP', [{92 ipv4: ipv4,93 stopAllObservers: stopAllObservers94 }]);95 96 } else {97 if (typeof failureCallback === 'function') {98 failureCallback('ipv4 must be a non zero string.')99 }100 }101};102/**103 * Observes changes of connectivity to a given ip v6.104 *105 * @param {!Object} ipv6 (Required) IP v6 to observe. Ex: ::ffff:192.168.1.0106 * @param {Boolean} stopAllObservers (Optional) Stop any existing observer. Default false107 * @param {function()} successCallback (Optional) Callback on success108 * @param {function()} failureCallback (Optional) Callback on fail109 */110connectivity.observeRemoteIPV6 = function (ipv6, stopAllObservers, successCallback, failureCallback) {111 if (typeof ipv6 === 'function') {112 failureCallback = stopAllObservers;113 successCallback = ipv6;114 ipv6 = undefined;115 116 } else if (typeof stopAllObservers === 'function') {117 failureCallback = successCallback;118 successCallback = stopAllObservers;119 stopAllObservers = false;120 }121 122 if (typeof ipv6 === 'string' && ipv6.length > 0) {123 cordova.exec(successCallback, failureCallback, 'connectivity', 'observeRemoteIP', [{124 ipv6: ipv6,125 stopAllObservers: stopAllObservers126 }]);127 128 } else {129 if (typeof failureCallback === 'function') {130 failureCallback('ipv6 must be a non zero string.')131 }132 }133};134/**135 * Observes changes of connectivity to local wifi.136 *137 * @param {Boolean} stopAllObservers (Optional) Stop any existing observer. Default false138 * @param {function()} successCallback (Optional) Callback on success139 * @param {function()} failureCallback (Optional) Callback on fail140 */141connectivity.observeLocalWifi = function (stopAllObservers, successCallback, failureCallback) {142 if (typeof stopAllObservers === 'function') {143 failureCallback = successCallback;144 successCallback = stopAllObservers;145 stopAllObservers = false;146 }147 148 cordova.exec(successCallback, failureCallback, 'connectivity', 'observeLocalWifi', [{149 stopAllObservers: stopAllObservers150 }]);151};152/**153 * Observes changes of connectivity to internet connection.154 *155 * @param {Boolean} stopAllObservers (Optional) Stop any existing observer. Default false156 * @param {function()} successCallback (Optional) Callback on success157 * @param {function()} failureCallback (Optional) Callback on fail158 */159connectivity.observeInternetConnection = function (stopAllObservers, successCallback, failureCallback) {160 if (typeof stopAllObservers === 'function') {161 failureCallback = successCallback;162 successCallback = stopAllObservers;163 stopAllObservers = false;164 }165 166 cordova.exec(successCallback, failureCallback, 'connectivity', 'observeInternetConnection', [{167 stopAllObservers: stopAllObservers168 }]);169};170/**171 * Stop any existing observer.172 *173 * @param {function()} successCallback (Optional) Callback on success174 * @param {function()} failureCallback (Optional) Callback on fail175 */176connectivity.stopAllObservers = function (successCallback, failureCallback) {177 cordova.exec(successCallback, failureCallback, 'connectivity', 'stopAllObservers', []);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var assert = require('assert');3var options = {4 desiredCapabilities: {5 }6};7var client = webdriverio.remote(options);8 .init()9 .click('~button')10 .pause(10000)11 .stop()12 .end();132018-02-06 17:35:53: [JSONWP Proxy] Got response with status 200: "{\"value\":\"\",\"sessionId\":\"C0EEDC3F-9B3D-4B3E-9B1C-08C8B6C8E2B2\",\"status\":0}"142018-02-06 17:35:53: [JSONWP Proxy] Got response with status 200: "{\"value\":\"\",\"sessionId\":\"9c9e6d8e-5a5c-4e7c-8a3e-7c5b5d1f7e1b\",\"status\":0}"

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require('webdriverio');2const assert = require('assert');3const opts = {4 capabilities: {5 }6};7const client = wdio.remote(opts);8client.init()9 .then(() => {10 return client.pause(10000);11 })12 .then(() => {13 return client.stop();14 })15 .then(() => {16 return client.init();17 })18 .then(() => {19 return client.pause(10000);20 })21 .then(() => {22 return client.stop();23 })24 .then(() => {25 return client.init();26 })27 .then(() => {28 return client.pause(10000);29 })30 .then(() => {31 return client.stop();32 })33 .then(() => {34 return client.init();35 })36 .then(() => {37 return client.pause(10000);38 })39 .then(() => {40 return client.stop();41 })42 .then(() => {43 return client.init();44 })45 .then(() => {46 return client.pause(10000);47 })48 .then(() => {49 return client.stop();50 })51 .then(() => {52 return client.init();53 })54 .then(() => {55 return client.pause(10000);56 })57 .then(() => {58 return client.stop();59 })60 .then(() => {61 return client.init();62 })63 .then(() => {64 return client.pause(10000);65 })66 .then(() => {67 return client.stop();68 })69 .then(() => {70 return client.init();71 })72 .then(() => {73 return client.pause(10000);74 })75 .then(() => {76 return client.stop();77 })78 .then(() => {79 return client.init();80 })81 .then(() => {82 return client.pause(10000);83 })84 .then(() => {85 return client.stop();86 })87 .then(() => {88 return client.init();89 })90 .then(() => {91 return client.pause(10000);92 })

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Stop Appium Xcuitest Driver', function() {2 it('should be able to stop the Appium Xcuitest Driver', async function() {3 await driver.stop();4 });5});6[HTTP] {}7[debug] [XCUITest] Shutting down xcodebuild process (pid 10078)8[debug] [XCUITest] Shutting down iproxy process (pid 10079)9[debug] [XCUITest] Shutting down fbsimctl process (pid 10080)10[debug] [BaseDriver] Event 'quitSessionFinished' logged at 1537342763993 (19:12:43 GMT+0530 (IST))11[debug] [W3C] Responding to client with driver.stop() result: null

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.stopRecordingScreen();2driver.startRecordingScreen({3});4driver.pullFile('/var/mobile/Media/DCIM/100APPLE/VIDEO001.MOV');5driver.removeApp('com.apple.Preferences');6driver.installApp('/Users/kazuaki/Library/Developer/Xcode/DerivedData/UICatalog-awbqkqjzqyqzqffxjxhjwqyqkqek/Build/Products/Debug-iphonesimulator/UICatalog.app');7driver.getAppStrings('en');8driver.setPermissions({9permissions: {10}11});12driver.getSettings();13driver.updateSettings({14});

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require('webdriverio');2const assert = require('assert');3const opts = {4 capabilities: {5 },6};7(async () => {8 const client = await wdio.remote(opts);9 await client.pause(5000);10 await client.stop();11})();12import io.appium.java_client.AppiumDriver;13import io.appium.java_client.MobileElement;14import io.appium.java_client.ios.IOSDriver;15import org.openqa.selenium.remote.DesiredCapabilities;16import java.net.MalformedURLException;17import java.net.URL;18public class test {19 public static void main(String[] args) throws MalformedURLException {20 DesiredCapabilities caps = new DesiredCapabilities();21 caps.setCapability("platformName", "iOS");22 caps.setCapability("platformVersion", "13.3");23 caps.setCapability("deviceName", "iPhone 11");24 caps.setCapability("app", "/Users/username/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphonesimulator/IntegrationApp.app");25 caps.setCapability("automationName", "XCUITest");26 caps.setCapability("noReset", true);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var serverConfig = {4};5var desiredCaps = {6};7var driver = wd.promiseChainRemote(serverConfig);8driver.init(desiredCaps)9 .then(function() {10 return driver.sleep(5000);11 })12 .then(function() {13 return driver.stop();14 })15 .then(function() {16 console.log('The app is stopped.');17 });18driver.quit();19var wd = require('wd');20var assert = require('assert');21var serverConfig = {22};23var desiredCaps = {24};25var driver = wd.promiseChainRemote(serverConfig);26driver.init(desiredCaps)27 .then(function() {28 return driver.sleep(5000);29 })30 .then(function() {31 return driver.activateApp('com.apple.mobilesafari');32 })33 .then(function() {34 console.log('The app is activated.');35 });36driver.quit();

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

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

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful