Best JavaScript code snippet using cypress
App.js
Source:App.js
1import { Component } from 'react';2import './App.css';3// ç¸å¼¹æ»æ°4const BUMP_COUNT = 1;5// æ°ç»ç»´åº¦6const DIMESION = 20;7const statusObj = {8 close: 'close',9 open: 'open',10};11function getObj() {12 const obj = {13 status: statusObj.close, // æ ¼åçç¶æ14 isBump: false, // æ¯å¦ä¸ºç¸å¼¹15 bumpCount: 0, // å¨å´æ ¼åçç¸å¼¹æ°16 };17 return obj;18}19// è·åå¨è¾¹æ ¼åçåæ ç³»20function getXyArr (i, j) {21 return [22 [i-1, j-1], [i-1, j], [i-1, j+1],23 [i, j-1], [i, j+1],24 [i+1, j-1], [i+1, j], [i+1, j+1]25 ];26}27class App extends Component {28 constructor(props) {29 super(props);30 this.state = {31 mapArr: [],32 totalBumpCount: 0,33 };34 }35 componentWillMount () {36 // åå§åäºç»´æ°ç»37 const mapArr = [];38 for (let i = 0; i < DIMESION; i++) {39 for (let j = 0; j < DIMESION; j++) {40 if (!mapArr[i]) mapArr[i] = [];41 mapArr[i][j] = getObj();42 }43 }44 // æ è®°ç¸å¼¹45 this.setBump(mapArr);46 // 计ç®å¨å´ç¸å¼¹æ°47 this.setBumpCount(mapArr);48 this.setState({ mapArr });49 }50 // æ è®°ç¸å¼¹51 setBump = (mapArr) => {52 let totalBumpCount = this.state.totalBumpCount;53 if (totalBumpCount < BUMP_COUNT) {54 const x = Math.floor(Math.random()*DIMESION);55 const y = Math.floor(Math.random()*DIMESION);56 if (!mapArr[x][y].isBump) {57 mapArr[x][y].isBump = true;58 this.state.totalBumpCount++;59 }60 this.setBump(mapArr);61 }62 }63 // ç»è®¡å¨å´æ ¼åçæ°é64 setBumpCount = (mapArr) => {65 mapArr.forEach((lineArr, i) => {66 lineArr.forEach((cell, j) => {67 const xyArr = getXyArr(i, j);68 const countArr = xyArr.map(xy => this.isBump(mapArr, xy[0], xy[1]));69 let count = 0;70 countArr.forEach(c => {71 if (c) count++;72 })73 cell.bumpCount = count;74 })75 })76 }77 // å¨å´æ ¼åæ¯å¦æç¸å¼¹78 isBump = (mapArr, row, col) => {79 const rowLen = mapArr.length;80 const colLen = mapArr[0].length;81 if (row >= 0 && row < rowLen && col >= 0 && col < colLen) {82 return mapArr[row][col].isBump;83 }84 return false;85 }86 // æå¼å¨å´çæ ¼å87 openCell = (mapArr, row, col) => {88 const rowLen = mapArr.length;89 const colLen = mapArr[0].length;90 if (row >= 0 && row < rowLen && col >= 0 && col < colLen) {91 mapArr[row][col].status = statusObj.open;92 }93 }94 handleClick = (cell, i, j) => {95 const status = cell.status;96 if (status === statusObj.close) {97 cell.status = statusObj.open;98 }99 this.setState({ mapArr: this.state.mapArr });100 if (cell.isBump) {101 setTimeout(() => {102 alert('Game Over !!!');103 window.location.reload();104 })105 return;106 } else if (cell.bumpCount === 0) {107 const mapArr = this.state.mapArr;108 const xyArr = getXyArr(i, j);109 xyArr.map(xy => this.openCell(mapArr, xy[0], xy[1]));110 this.setState({ mapArr }, () => {111 this.testWinGame();112 });113 }114 this.testWinGame();115 }116 // æµè¯æ¸¸ææ¯å¦å·²ç»èå©117 testWinGame = () => {118 let isWin = true;119 const mapArr = this.state.mapArr;120 mapArr.forEach(row => {121 row.forEach(cell => {122 if (!cell.isBump && cell.status === statusObj.close) {123 isWin = false;124 }125 })126 })127 if (isWin) {128 setTimeout(() => {129 alert('Win!!!');130 window.location.reload();131 })132 }133 }134 render () {135 return (136 <div className="container">137 <button onClick={() => window.location.reload()}>Restart</button>138 {139 this.state.mapArr.map((row, i) => (140 <div className="row">141 {142 row.map((cell, j) => {143 const isOpen = cell.status === statusObj.open;144 let text = cell.isBump ? '*' : cell.bumpCount;145 146 if (cell.isBump) {147 text = isOpen ? '*' : '';148 } else {149 text = isOpen && cell.bumpCount ? cell.bumpCount : '';150 }151 152 return (153 <span className={`cell ${isOpen ? 'open' : ''} ${cell.isBump ? 'bump' : ''}`} onClick={() => {154 this.handleClick(cell, i, j)155 }}>156 {text}157 </span>158 )159 })160 }161 </div>162 ))163 }164 </div>165 );166 }167}...
BumpMapNode.js
Source:BumpMapNode.js
1import { TempNode } from '../core/TempNode.js';2import { FloatNode } from '../inputs/FloatNode.js';3import { FunctionNode } from '../core/FunctionNode.js';4import { NormalNode } from '../accessors/NormalNode.js';5import { PositionNode } from '../accessors/PositionNode.js';6function BumpMapNode( value, scale ) {7 TempNode.call( this, 'v3' );8 this.value = value;9 this.scale = scale || new FloatNode( 1 );10 this.toNormalMap = false;11}12BumpMapNode.Nodes = ( function () {13 var dHdxy_fwd = new FunctionNode( [14 // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen15 // http://api.unrealengine.com/attachments/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/mm_sfgrad_bump.pdf16 // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)17 "vec2 dHdxy_fwd( sampler2D bumpMap, vec2 vUv, float bumpScale ) {",18 // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #998819 " vec2 dSTdx = dFdx( vUv );",20 " vec2 dSTdy = dFdy( vUv );",21 " float Hll = bumpScale * texture2D( bumpMap, vUv ).x;",22 " float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;",23 " float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;",24 " return vec2( dBx, dBy );",25 "}"26 ].join( "\n" ), null, { derivatives: true } );27 var perturbNormalArb = new FunctionNode( [28 "vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {",29 // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #998830 " vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );",31 " vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );",32 " vec3 vN = surf_norm;", // normalized33 " vec3 R1 = cross( vSigmaY, vN );",34 " vec3 R2 = cross( vN, vSigmaX );",35 " float fDet = dot( vSigmaX, R1 );",36 " fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );",37 " vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );",38 " return normalize( abs( fDet ) * surf_norm - vGrad );",39 "}"40 ].join( "\n" ), [ dHdxy_fwd ], { derivatives: true } );41 var bumpToNormal = new FunctionNode( [42 "vec3 bumpToNormal( sampler2D bumpMap, vec2 uv, float scale ) {",43 " vec2 dSTdx = dFdx( uv );",44 " vec2 dSTdy = dFdy( uv );",45 " float Hll = texture2D( bumpMap, uv ).x;",46 " float dBx = texture2D( bumpMap, uv + dSTdx ).x - Hll;",47 " float dBy = texture2D( bumpMap, uv + dSTdy ).x - Hll;",48 " return vec3( .5 - ( dBx * scale ), .5 - ( dBy * scale ), 1.0 );",49 "}"50 ].join( "\n" ), null, { derivatives: true } );51 return {52 dHdxy_fwd: dHdxy_fwd,53 perturbNormalArb: perturbNormalArb,54 bumpToNormal: bumpToNormal55 };56} )();57BumpMapNode.prototype = Object.create( TempNode.prototype );58BumpMapNode.prototype.constructor = BumpMapNode;59BumpMapNode.prototype.nodeType = "BumpMap";60BumpMapNode.prototype.hashProperties = [ "toNormalMap" ];61BumpMapNode.prototype.generate = function ( builder, output ) {62 if ( builder.isShader( 'fragment' ) ) {63 if ( this.toNormalMap ) {64 var bumpToNormal = builder.include( BumpMapNode.Nodes.bumpToNormal );65 return builder.format( bumpToNormal + '( ' + this.value.build( builder, 'sampler2D' ) + ', ' +66 this.value.uv.build( builder, 'v2' ) + ', ' +67 this.scale.build( builder, 'f' ) + ' )', this.getType( builder ), output );68 } else {69 var derivativeHeight = builder.include( BumpMapNode.Nodes.dHdxy_fwd ),70 perturbNormalArb = builder.include( BumpMapNode.Nodes.perturbNormalArb );71 this.normal = this.normal || new NormalNode();72 this.position = this.position || new PositionNode( PositionNode.VIEW );73 var derivativeHeightCode = derivativeHeight + '( ' + this.value.build( builder, 'sampler2D' ) + ', ' +74 this.value.uv.build( builder, 'v2' ) + ', ' +75 this.scale.build( builder, 'f' ) + ' )';76 return builder.format( perturbNormalArb + '( -' + this.position.build( builder, 'v3' ) + ', ' +77 this.normal.build( builder, 'v3' ) + ', ' +78 derivativeHeightCode + ' )', this.getType( builder ), output );79 }80 } else {81 console.warn( "THREE.BumpMapNode is not compatible with " + builder.shader + " shader." );82 return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );83 }84};85BumpMapNode.prototype.copy = function ( source ) {86 TempNode.prototype.copy.call( this, source );87 this.value = source.value;88 this.scale = source.scale;89 return this;90};91BumpMapNode.prototype.toJSON = function ( meta ) {92 var data = this.getJSONNode( meta );93 if ( ! data ) {94 data = this.createJSONNode( meta );95 data.value = this.value.toJSON( meta ).uuid;96 data.scale = this.scale.toJSON( meta ).uuid;97 }98 return data;99};...
bump-version.js
Source:bump-version.js
1const fs = require('fs');2/**3 * ARC version numbers consist of 4 parts: MAJOR.MINOR.BUILD.PATCH.4 * - MAJOR must get updated with every release5 * - MINOR must get updated with every hotfix release6 * - BUILD must get updated whenever a release candidate is built from the develop trunk7 * (at least weekly for Dev channel release candidates).8 * The BUILD number is an ever-increasing number representing a point in time of the trunk.9 * - PATCH must get updated whenever a release candidate is built from the FEATURE branch.10 */11var Bump = {12 manifest: './app/manifest.json',13 bower: './bower.json',14 package: './package.json',15 getPackage: () => {16 return JSON.parse(fs.readFileSync(Bump.package, 'utf8'));17 },18 getBower: () => {19 return JSON.parse(fs.readFileSync(Bump.bower, 'utf8'));20 },21 getManifest: () => {22 return JSON.parse(fs.readFileSync(Bump.manifest, 'utf8'));23 },24 setPackage: (packageContent) => {25 packageContent = JSON.stringify(packageContent, null, 2);26 return fs.writeFileSync(Bump.package, packageContent, 'utf8');27 // console.log(packageContent);28 },29 setBower: (bower) => {30 bower = JSON.stringify(bower, null, 2);31 return fs.writeFileSync(Bump.bower, bower, 'utf8');32 // console.log(bower);33 },34 setManifest: (manifest) => {35 manifest = JSON.stringify(manifest, null, 2);36 return fs.writeFileSync(Bump.manifest, manifest, 'utf8');37 // console.log(manifest);38 },39 /**40 * Bump the version in bower.json, package.json and manifest.json.41 *42 * @param {Object} options An options to pass.43 * - {String} target A build target: 'canary', 'dev', 'beta-release', 'beta-hotfix', 'stable',44 * 'hotfix'45 * For `canary` release (daily build) the PATCH number will increase.46 * For `dev` release (weekly build) the BUILD number will increase.47 * For `beta-release` release will increase the MAJOR and MINOR will be set to 0.48 * for `beta-hotfix` release (where hotfix is applied to the beta) MINOR version will increase49 * For `stable` release the MINOR number will be set to 0.50 * For `hotfix` release the MINOR number will increase.51 */52 bump: (options) => {53 var manifest = Bump.getManifest();54 var version = '0.0.0.0';55 var versionName = 'stable';56 if (manifest && manifest.version) {57 version = manifest.version;58 }59 var parts = version.split('.');60 version = [0, 0, 0, 0];61 parts.forEach((no, i) => {62 no = Number(no);63 if (no !== no) {64 no = 0;65 }66 version[i] = no;67 });68 switch (options.target) {69 case 'canary':70 version = Bump._bumpCanary(version);71 versionName = 'canary';72 break;73 case 'dev':74 version = Bump._bumpDev(version);75 versionName = 'dev';76 break;77 case 'beta-release':78 version = Bump._bumpBetaRelease(version);79 versionName = 'beta';80 break;81 case 'beta-hotfix':82 version = Bump._bumpBetaHotfix(version);83 versionName = 'beta';84 break;85 case 'stable-release':86 version = Bump._bumpStable(version);87 break;88 case 'stable-hotfix':89 version = Bump._bumpHotfix(version);90 break;91 default:92 throw new Error(`Unknown target ${options.target}`);93 }94 var bower = Bump.getBower();95 var packageFile = Bump.getPackage();96 manifest.version = version.manifest;97 //jscs:disable requireCamelCaseOrUpperCaseIdentifiers98 manifest.version_name = `${version.manifest}-${versionName}`;99 //jscs:enable requireCamelCaseOrUpperCaseIdentifiers100 bower.version = version.package;101 packageFile.version = version.package;102 Bump.setPackage(packageFile);103 Bump.setBower(bower);104 Bump.setManifest(manifest);105 return manifest.version;106 },107 _bumpCanary: function(version) {108 version[3]++;109 return Bump._combineVersion(version);110 },111 _bumpDev: function(version) {112 version[2]++;113 return Bump._combineVersion(version);114 },115 _bumpBetaRelease: function(version) {116 version[0]++;117 version[1] = 0;118 return Bump._combineVersion(version);119 },120 _bumpBetaHotfix: function(version) {121 version[1]++;122 return Bump._combineVersion(version);123 },124 _bumpStable: function(version) {125 version[1]++;126 version[3]++;127 return Bump._combineVersion(version);128 },129 _bumpHotfix: function(version) {130 version[1]++;131 version[3]++;132 return Bump._combineVersion(version);133 },134 _combineVersion: function(version) {135 var result = {136 manifest: version.join('.')137 };138 version.pop();139 result.package = version.join('.');140 return result;141 }142};...
index.js
Source:index.js
1/*2 * This file is part of the nivo project.3 *4 * Copyright 2016-present, Raphaël Benitte.5 *6 * For the full copyright and license information, please view the LICENSE7 * file that was distributed with this source code.8 */9import React from 'react'10import range from 'lodash/range'11import random from 'lodash/random'12import { patternDotsDef, patternLinesDef } from '@banzaicloud/nivo-core'13import { ResponsiveAreaBump, AreaBumpDefaultProps } from '@banzaicloud/nivo-bump'14import ComponentTemplate from '../../components/components/ComponentTemplate'15import meta from '../../data/components/area-bump/meta.yml'16import { groups } from '../../data/components/area-bump/props'17import mapper from '../../data/components/area-bump/mapper'18const serieIds = ['JavaScript', 'ReasonML', 'TypeScript', 'Elm', 'CoffeeScript']19const generateData = () => {20 const years = range(2000, 2006)21 const series = serieIds.map(id => ({22 id,23 data: years.map(year => ({24 x: year,25 y: random(10, 30),26 })),27 }))28 return series29}30const initialProperties = {31 margin: {32 top: 40,33 right: 100,34 bottom: 40,35 left: 100,36 },37 align: AreaBumpDefaultProps.align,38 interpolation: AreaBumpDefaultProps.interpolation,39 spacing: 8,40 xPadding: AreaBumpDefaultProps.xPadding,41 colors: { scheme: 'nivo' },42 blendMode: 'multiply',43 fillOpacity: AreaBumpDefaultProps.fillOpacity,44 activeFillOpacity: AreaBumpDefaultProps.activeFillOpacity,45 inactiveFillOpacity: AreaBumpDefaultProps.inactiveFillOpacity,46 defs: [47 patternDotsDef('dots', {48 background: 'inherit',49 color: '#38bcb2',50 size: 4,51 padding: 1,52 stagger: true,53 }),54 patternLinesDef('lines', {55 background: 'inherit',56 color: '#eed312',57 rotation: -45,58 lineWidth: 6,59 spacing: 10,60 }),61 ],62 fill: [63 { match: { id: 'CoffeeScript' }, id: 'dots' },64 { match: { id: 'TypeScript' }, id: 'lines' },65 ],66 borderWidth: AreaBumpDefaultProps.borderWidth,67 activeBorderWidth: AreaBumpDefaultProps.activeBorderWidth,68 inactiveBorderWidth: AreaBumpDefaultProps.inactiveBorderWidth,69 borderColor: AreaBumpDefaultProps.borderColor,70 borderOpacity: AreaBumpDefaultProps.borderOpacity,71 activeBorderOpacity: AreaBumpDefaultProps.activeBorderOpacity,72 inactiveBorderOpacity: AreaBumpDefaultProps.inactiveBorderOpacity,73 startLabel: 'id',74 startLabelPadding: AreaBumpDefaultProps.startLabelPadding,75 startLabelTextColor: AreaBumpDefaultProps.startLabelTextColor,76 endLabel: 'id',77 endLabelPadding: AreaBumpDefaultProps.endLabelPadding,78 endLabelTextColor: AreaBumpDefaultProps.endLabelTextColor,79 enableGridX: AreaBumpDefaultProps.enableGridX,80 axisTop: {81 enable: true,82 tickSize: 5,83 tickPadding: 5,84 tickRotation: 0,85 legend: '',86 legendPosition: 'middle',87 legendOffset: -36,88 },89 axisBottom: {90 enable: true,91 tickSize: 5,92 tickPadding: 5,93 tickRotation: 0,94 legend: '',95 legendPosition: 'middle',96 legendOffset: 32,97 },98 isInteractive: true,99 animate: AreaBumpDefaultProps.animate,100 motionConfig: AreaBumpDefaultProps.motionConfig,101}102const Bump = () => {103 return (104 <ComponentTemplate105 name="AreaBump"106 meta={meta.AreaBump}107 icon="area-bump"108 flavors={meta.flavors}109 currentFlavor="svg"110 properties={groups}111 defaultProperties={AreaBumpDefaultProps}112 initialProperties={initialProperties}113 propertiesMapper={mapper}114 generateData={generateData}115 >116 {(properties, data, theme, logAction) => {117 return (118 <ResponsiveAreaBump119 data={data}120 {...properties}121 theme={theme}122 onClick={serie =>123 logAction({124 type: 'click',125 label: `[serie] ${serie.id}`,126 color: serie.color,127 data: serie,128 })129 }130 />131 )132 }}133 </ComponentTemplate>134 )135}...
JoyButtons.js
Source:JoyButtons.js
1// Auto-generated. Do not edit!2// (in-package mini_ros.msg)3"use strict";4const _serializer = _ros_msg_utils.Serialize;5const _arraySerializer = _serializer.Array;6const _deserializer = _ros_msg_utils.Deserialize;7const _arrayDeserializer = _deserializer.Array;8const _finder = _ros_msg_utils.Find;9const _getByteLength = _ros_msg_utils.getByteLength;10//-----------------------------------------------------------11class JoyButtons {12 constructor(initObj={}) {13 if (initObj === null) {14 // initObj === null is a special case for deserialization where we don't initialize fields15 this.updown = null;16 this.leftright = null;17 this.left_bump = null;18 this.right_bump = null;19 }20 else {21 if (initObj.hasOwnProperty('updown')) {22 this.updown = initObj.updown23 }24 else {25 this.updown = 0;26 }27 if (initObj.hasOwnProperty('leftright')) {28 this.leftright = initObj.leftright29 }30 else {31 this.leftright = 0;32 }33 if (initObj.hasOwnProperty('left_bump')) {34 this.left_bump = initObj.left_bump35 }36 else {37 this.left_bump = 0;38 }39 if (initObj.hasOwnProperty('right_bump')) {40 this.right_bump = initObj.right_bump41 }42 else {43 this.right_bump = 0;44 }45 }46 }47 static serialize(obj, buffer, bufferOffset) {48 // Serializes a message object of type JoyButtons49 // Serialize message field [updown]50 bufferOffset = _serializer.int8(obj.updown, buffer, bufferOffset);51 // Serialize message field [leftright]52 bufferOffset = _serializer.int8(obj.leftright, buffer, bufferOffset);53 // Serialize message field [left_bump]54 bufferOffset = _serializer.int8(obj.left_bump, buffer, bufferOffset);55 // Serialize message field [right_bump]56 bufferOffset = _serializer.int8(obj.right_bump, buffer, bufferOffset);57 return bufferOffset;58 }59 static deserialize(buffer, bufferOffset=[0]) {60 //deserializes a message object of type JoyButtons61 let len;62 let data = new JoyButtons(null);63 // Deserialize message field [updown]64 data.updown = _deserializer.int8(buffer, bufferOffset);65 // Deserialize message field [leftright]66 data.leftright = _deserializer.int8(buffer, bufferOffset);67 // Deserialize message field [left_bump]68 data.left_bump = _deserializer.int8(buffer, bufferOffset);69 // Deserialize message field [right_bump]70 data.right_bump = _deserializer.int8(buffer, bufferOffset);71 return data;72 }73 static getMessageSize(object) {74 return 4;75 }76 static datatype() {77 // Returns string type for a message object78 return 'mini_ros/JoyButtons';79 }80 static md5sum() {81 //Returns md5sum for a message object82 return 'be1de48c3b52ec87587be0e78c2cb8cd';83 }84 static messageDefinition() {85 // Returns full string definition for message86 return `87 int8 updown88 int8 leftright89 int8 left_bump90 int8 right_bump91 `;92 }93 static Resolve(msg) {94 // deep-construct a valid message object instance of whatever was passed in95 if (typeof msg !== 'object' || msg === null) {96 msg = {};97 }98 const resolved = new JoyButtons(null);99 if (msg.updown !== undefined) {100 resolved.updown = msg.updown;101 }102 else {103 resolved.updown = 0104 }105 if (msg.leftright !== undefined) {106 resolved.leftright = msg.leftright;107 }108 else {109 resolved.leftright = 0110 }111 if (msg.left_bump !== undefined) {112 resolved.left_bump = msg.left_bump;113 }114 else {115 resolved.left_bump = 0116 }117 if (msg.right_bump !== undefined) {118 resolved.right_bump = msg.right_bump;119 }120 else {121 resolved.right_bump = 0122 }123 return resolved;124 }125};...
Gruntfile.js
Source:Gruntfile.js
1module.exports = function(grunt) {2 'use strict';3 grunt.initConfig({4 pkg: grunt.file.readJSON('package.json'),5 bump: {6 options: {7 files: ['package.json', 'bower.json'],8 updateConfigs: [],9 commit: true,10 commitMessage: 'Bumped to release v%VERSION%',11 commitFiles: ['package.json', 'bower.json'],12 createTag: true,13 tagName: 'v%VERSION%',14 tagMessage: 'Version %VERSION%',15 push: false,16 pushTo: 'upstream',17 gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',18 globalReplace: false,19 prereleaseName: false,20 regExp: false21 }22 }23 });24 grunt.loadNpmTasks('grunt-bump');25 /**\/26 $ grunt bump27 >> Version bumped to 0.0.228 >> Committed as "Release v0.0.2"29 >> Tagged as "v0.0.2"30 >> Pushed to origin31 $ grunt bump:patch32 >> Version bumped to 0.0.333 >> Committed as "Release v0.0.3"34 >> Tagged as "v0.0.3"35 >> Pushed to origin36 $ grunt bump:minor37 >> Version bumped to 0.1.038 >> Committed as "Release v0.1.0"39 >> Tagged as "v0.1.0"40 >> Pushed to origin41 $ grunt bump:major42 >> Version bumped to 1.0.043 >> Committed as "Release v1.0.0"44 >> Tagged as "v1.0.0"45 >> Pushed to origin46 $ grunt bump:patch47 >> Version bumped to 1.0.148 >> Committed as "Release v1.0.1"49 >> Tagged as "v1.0.1"50 >> Pushed to origin51 $ grunt bump:git52 >> Version bumped to 1.0.1-ge96c53 >> Committed as "Release v1.0.1-ge96c"54 >> Tagged as "v1.0.1-ge96c"55 >> Pushed to origin56 $ grunt bump:prepatch57 >> Version bumped to 1.0.2-058 >> Committed as "Release v1.0.2-0"59 >> Tagged as "v1.0.2-0"60 >> Pushed to origin61 $ grunt bump:prerelease62 >> Version bumped to 1.0.2-163 >> Committed as "Release v1.0.2-1"64 >> Tagged as "v1.0.2-1"65 >> Pushed to origin66 $ grunt bump:patch # (major, minor or patch) will do this67 >> Version bumped to 1.0.268 >> Committed as "Release v1.0.2"69 >> Tagged as "v1.0.2"70 >> Pushed to origin71 $ grunt bump:preminor72 >> Version bumped to 1.1.0-073 >> Committed as "Release v1.1.0-0"74 >> Tagged as "v1.1.0-0"75 >> Pushed to origin76 $ grunt bump77 >> Version bumped to 1.1.078 >> Committed as "Release v1.1.0"79 >> Tagged as "v1.1.0"80 >> Pushed to origin81 $ grunt bump:premajor (with prerelaseName set to 'rc' in options)82 >> Version bumped to 2.0.0-rc.083 >> Committed as "Release v2.0.0-rc.0"84 >> Tagged as "v2.0.0-rc.0"85 >> Pushed to origin86 $ grunt bump87 >> Version bumped to 2.0.088 >> Committed as "Release v2.0.0"89 >> Tagged as "v2.0.0"90 >> Pushed to origin91 $ grunt bump:prerelease # from a released version `prerelease` defaults to prepatch92 >> Version bumped to 2.0.1-rc.093 >> Committed as "Release v2.0.1-rc.0"94 >> Tagged as "v2.0.1-rc.0"95 >> Pushed to origin96 /**/...
BumpNode.js
Source:BumpNode.js
1/**2 * @author sunag / http://www.sunag.com.br/3 */4THREE.BumpNode = function ( value, coord, scale ) {5 THREE.TempNode.call( this, 'v3' );6 this.value = value;7 this.coord = coord || new THREE.UVNode();8 this.scale = scale || new THREE.Vector2Node( 1, 1 );9};10THREE.BumpNode.fBumpToNormal = new THREE.FunctionNode( [11 "vec3 bumpToNormal( sampler2D bumpMap, vec2 uv, vec2 scale ) {",12 " vec2 dSTdx = dFdx( uv );",13 " vec2 dSTdy = dFdy( uv );",14 " float Hll = texture2D( bumpMap, uv ).x;",15 " float dBx = texture2D( bumpMap, uv + dSTdx ).x - Hll;",16 " float dBy = texture2D( bumpMap, uv + dSTdy ).x - Hll;",17 " return vec3( .5 + ( dBx * scale.x ), .5 + ( dBy * scale.y ), 1.0 );",18 "}"19].join( "\n" ), null, { derivatives: true } );20THREE.BumpNode.prototype = Object.create( THREE.TempNode.prototype );21THREE.BumpNode.prototype.constructor = THREE.BumpNode;22THREE.BumpNode.prototype.nodeType = "Bump";23THREE.BumpNode.prototype.generate = function ( builder, output ) {24 var material = builder.material, func = THREE.BumpNode.fBumpToNormal;25 builder.include( func );26 if ( builder.isShader( 'fragment' ) ) {27 return builder.format( func.name + '(' + this.value.build( builder, 'sampler2D' ) + ',' +28 this.coord.build( builder, 'v2' ) + ',' +29 this.scale.build( builder, 'v2' ) + ')', this.getType( builder ), output );30 } else {31 console.warn( "THREE.BumpNode is not compatible with " + builder.shader + " shader." );32 return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );33 }34};35THREE.BumpNode.prototype.toJSON = function ( meta ) {36 var data = this.getJSONNode( meta );37 if ( ! data ) {38 data = this.createJSONNode( meta );39 data.value = this.value.toJSON( meta ).uuid;40 data.coord = this.coord.toJSON( meta ).uuid;41 data.scale = this.scale.toJSON( meta ).uuid;42 }43 return data;...
Using AI Code Generation
1cy.get('button').bump({ x: 100, y: 100 })2Cypress.Commands.add('bump', { prevSubject: 'element' }, ($el, { x, y }) => {3 $el[0].dispatchEvent(4 new MouseEvent('mousedown', {5 clientX: $el[0].getBoundingClientRect().x + x,6 clientY: $el[0].getBoundingClientRect().y + y,7 })8 $el[0].dispatchEvent(9 new MouseEvent('mouseup', {10 clientX: $el[0].getBoundingClientRect().x + x,11 clientY: $el[0].getBoundingClientRect().y + y,12 })13})14cy.get('button').bump({ x: 100, y: 100 })15cy.get('button').bump({ x: 100, y: 100 })16cy.get('button').bump({ x: 100, y: 100 })17 .bump({ x: 100, y: 100 })18Cypress.Commands.add('bump', { prevSubject: 'element' }, ($el, { x, y }) => {19 $el[0].dispatchEvent(20 new MouseEvent('mousedown', {21 clientX: $el[0].getBoundingClientRect().x + x,22 clientY: $el[0].getBoundingClientRect().y + y,23 })24 $el[0].dispatchEvent(25 new MouseEvent('mouseup', {26 clientX: $el[0].getBoundingClientRect().x + x,
Using AI Code Generation
1it('should bump the counter', () => {2 cy.get('.counter').should('have.text', '0')3 cy.get('.button').click()4 cy.get('.counter').should('have.text', '1')5})6describe('Counter', () => {7 it('should bump the counter', () => {8 cy.get('.counter').should('have.text', '0')9 cy.get('.button').click()10 cy.get('.counter').should('have.text', '1')11 })12})13describe('Counter', () => {14 it('should bump the counter', () => {15 cy.get('.counter').should('have.text', '0')16 cy.get('.button').click()17 cy.get('.counter').should('have.text', '1')18 })19})20describe('Counter', () => {21 it('should bump the counter', () => {22 cy.get('.counter').should('have.text', '0')23 cy.get('.button').click()24 cy.get('.counter').should('have.text', '1')25 })26})27describe('Counter', () => {28 it('should bump the counter', () => {29 cy.get('.counter').should('have.text', '0')30 cy.get('.button').click()31 cy.get('.counter').should('have.text', '1')32 })33})34describe('Counter', () => {35 it('should bump the counter', () => {36 cy.get('.counter').should('have.text', '0')37 cy.get('.button').click()38 cy.get('.counter').should('have.text', '1
Using AI Code Generation
1Cypress.Commands.add('bump', (selector) => {2 cy.get(selector).click({ force: true })3})4Cypress.Commands.add('bump', (selector) => {5 cy.get(selector).click({ force: true })6})7Cypress.Commands.add('bump', (selector) => {8 cy.get(selector).click({ force: true })9})10Cypress.Commands.add('bump', (selector) => {11 cy.get(selector).click({ force: true })12})13Cypress.Commands.add('bump', (selector) => {14 cy.get(selector).click({ force: true })15})16Cypress.Commands.add('bump', (selector) => {17 cy.get(selector).click({ force: true })18})19Cypress.Commands.add('bump', (selector) => {20 cy.get(selector).click({ force: true })21})22Cypress.Commands.add('bump', (selector) => {23 cy.get(selector).click({ force: true })24})25Cypress.Commands.add('bump', (selector) => {26 cy.get(selector).click({ force: true })27})28Cypress.Commands.add('bump', (selector) => {29 cy.get(selector).click({ force: true })30})31Cypress.Commands.add('bump', (selector) => {32 cy.get(selector).click({ force: true })33})
Using AI Code Generation
1it('should bump the version', () => {2 cy.bump('patch')3})4#### `bump(version, options)`5it('should bump the version', () => {6 cy.bump('minor', { git: true })7})8it('should bump the version', () => {9 cy.bump('minor', { git: true })10})11Default: `Bump version to {version}`12it('should bump the version', () => {13 cy.bump('minor', { git: true, gitMessage: 'Bump minor version' })14})15it('should bump the version', () => {16 cy.bump('minor', { git: true, gitTag: true })17})18Default: `Version {version}`19it('should bump the version', () => {20 cy.bump('minor', { git: true, gitTag: true, gitTagMessage: 'Version {version}' })21})22Default: `v{version}`23it('should bump the version', () => {24 cy.bump('minor', { git: true, gitTag: true, gitTagName: 'v{version}'
Using AI Code Generation
1cy.get('.bump').click()2cy.get('.bump').bump()3import 'cypress-bump'4cy.get('button').bump()5describe('bump', () => {6 it('bumps the element', () => {7 cy.visit('cypress/fixtures/example.html')8 cy.get('.bump').bump()9 cy.get('.bump').should('have.css', 'transform', 'matrix(1, 0, 0, 1, 0, 0)')10 cy.get('.bump').bump({ x: 10, y: 10 })11 cy.get('.bump').should('have.css', 'transform', 'matrix(1, 0, 0, 1, 10, 10)')12 cy.get('.bump').bump({ x: 10, y: 10, duration: 1000 })13 cy.get('.bump').should('have.css', 'transition-duration', '1000ms')14 })15})16### bump(options)
Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.
You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!