Best JavaScript code snippet using wpt
RefSpec.js
Source:RefSpec.js
...3const { expect } = require('chai');4describe('Ref', () => {5 describe('#isRef', () => {6 it('should handle invalid refs', () => {7 expect(Ref.isRef(6786876)).to.equal(false);8 expect(Ref.isRef({})).to.equal(false);9 expect(Ref.isRef(false)).to.equal(false);10 expect(Ref.isRef('yar')).to.equal(false);11 expect(Ref.isRef(null)).to.equal(false);12 expect(Ref.isRef()).to.equal(false);13 expect(Ref.isRef('/defect')).to.equal(false);14 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/1.32/defect/abc.js')).to.equal(false);15 expect(Ref.isRef('')).to.equal(false);16 });17 it('should handle basic refs', () => {18 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/1.17/builddefinition/81177657')).to.equal(true);19 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/1.17/builddefinition/81177657.js')).to.equal(true);20 expect(Ref.isRef('/builddefinition/81177657.js')).to.equal(true);21 expect(Ref.isRef('/builddefinition/81177657')).to.equal(true);22 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/builddefinition/3493b049-3ea7-4c9a-bf78-069487936c13')).to.equal(true);23 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/builddefinition/3493b0493ea74c9abf78069487936c13')).to.equal(true);24 expect(Ref.isRef('/builddefinition/3493b049-3ea7-4c9a-bf78-069487936c13')).to.equal(true);25 expect(Ref.isRef('/builddefinition/3493b0493ea74c9abf78069487936c13')).to.equal(true);26 });27 it('should handle permission refs', () => {28 expect(Ref.isRef('/projectpermission/1234u5678p1')).to.equal(true);29 expect(Ref.isRef('/projectpermission/1234u5678p1.js')).to.equal(true);30 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/projectpermission/1234u5678p1.js')).to.equal(true);31 expect(Ref.isRef('/workspacepermission/1234u5678w1')).to.equal(true);32 expect(Ref.isRef('/workspacepermission/1234u5678w1.js')).to.equal(true);33 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/workspacepermission/1234u5678w1.js')).to.equal(true);34 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/workspacepermission/1637adf8-0830-4a48-9420-fb5bdb8575d6u3497d043-3ea7-4c2c-bf78-069847936c13w1')).to.equal(true);35 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/workspacepermission/1637adf808304a489420fb5bdb8575d6u3497d0433ea74c2cbf78069847936c13w1')).to.equal(true);36 expect(Ref.isRef('/workspacepermission/1637adf8-0830-4a48-9420-fb5bdb8575d6u3497d043-3ea7-4c2c-bf78-069847936c13w1')).to.equal(true);37 expect(Ref.isRef('/workspacepermission/1637adf808304a489420fb5bdb8575d6u3497d0433ea74c2cbf78069847936c13w1')).to.equal(true);38 });39 it('should handle built-in refs', () => {40 expect(Ref.isRef('/typedefinition/-1234.js')).to.equal(true);41 expect(Ref.isRef('/typedefinition/-1234')).to.equal(true);42 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/-1234')).to.equal(true);43 expect(Ref.isRef('/typedefinition/-1234/attributes')).to.equal(true);44 });45 it('should handle objects', () => {46 expect(Ref.isRef({ _ref: '/defect/12345' })).to.equal(true);47 expect(Ref.isRef({ _ref: 'https://rally1.rallydev.com/slm/webservice/v2.0/defect/12345' })).to.equal(true);48 expect(Ref.isRef({ _ref: 'https://rally1.rallydev.com/slm/webservice/v3.0/defect/3493b049-3ea7-4c9a-bf78-069487936c13' })).to.equal(true);49 expect(Ref.isRef({ _ref: 'https://rally1.rallydev.com/slm/webservice/v3.0/defect/3493b0493ea74c9abf78069487936c13' })).to.equal(true);50 expect(Ref.isRef({ _ref: '/defect/3493b049-3ea7-4c9a-bf78-069487936c13' })).to.equal(true);51 expect(Ref.isRef({ _ref: '/defect/3493b0493ea74c9abf78069487936c13' })).to.equal(true);52 });53 it('should handle dynatype refs', () => {54 expect(Ref.isRef('/portfolioitem/feature/1234')).to.equal(true);55 expect(Ref.isRef('/portfolioitem/feature/1234.js')).to.equal(true);56 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/1.32/portfolioitem/feature/1234')).to.equal(true);57 expect(Ref.isRef('http://rally1.rallydev.com/slm/webservice/1.32/portfolioitem/feature/1234.js')).to.equal(true);58 expect(Ref.isRef('/portfolioitem/feature/1234/children.js')).to.equal(true);59 expect(Ref.isRef('/portfolioitem/feature/1234/children')).to.equal(true);60 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/1234/children')).to.equal(true);61 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/portfolioitem/feature/3493b049-3ea7-4c9a-bf78-069487936c13/children')).to.equal(true);62 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/portfolioitem/feature/3493b0493ea74c9abf78069487936c13/children')).to.equal(true);63 expect(Ref.isRef('/portfolioitem/feature/3493b049-3ea7-4c9a-bf78-069487936c13/children')).to.equal(true);64 expect(Ref.isRef('/portfolioitem/feature/3493b0493ea74c9abf78069487936c13/children')).to.equal(true);65 });66 });67 describe('#getRelative', () => {68 it('should handle non-refs', () => {69 expect(!Ref.getRelative('blah'));70 expect(!Ref.getRelative(''));71 expect(!Ref.getRelative(null));72 expect(!Ref.getRelative({}));73 expect(!Ref.getRelative({ _ref: null }));74 });75 it('should handle basic refs', () => {76 expect(Ref.getRelative('/defect/1234')).to.equal('/defect/1234');77 expect(Ref.getRelative('/defect/1234.js')).to.equal('/defect/1234');78 expect(Ref.getRelative('https://rally1.rallydev.com/slm/webservice/1.32/defect/1234')).to.equal('/defect/1234');...
ref.spec.js
Source:ref.spec.js
...3const refUtils = rally.util.ref;4describe('Ref', () => {5 describe('#isRef', () => {6 it('should handle invalid refs', () => {7 refUtils.isRef(6786876).should.eql(false);8 refUtils.isRef({}).should.eql(false);9 refUtils.isRef(false).should.eql(false);10 refUtils.isRef('yar').should.eql(false);11 refUtils.isRef(null).should.eql(false);12 refUtils.isRef().should.eql(false);13 refUtils.isRef('/defect').should.eql(false);14 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/1.32/defect/abc.js').should.eql(false);15 refUtils.isRef('').should.eql(false);16 });17 it('should handle basic refs', () => {18 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/1.17/builddefinition/81177657').should.eql(true);19 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/1.17/builddefinition/81177657.js').should.eql(true);20 refUtils.isRef('/builddefinition/81177657.js').should.eql(true);21 refUtils.isRef('/builddefinition/81177657').should.eql(true);22 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/builddefinition/3493b049-3ea7-4c9a-bf78-069487936c13').should.eql(true);23 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/builddefinition/3493b0493ea74c9abf78069487936c13').should.eql(true);24 refUtils.isRef('/builddefinition/3493b049-3ea7-4c9a-bf78-069487936c13').should.eql(true);25 refUtils.isRef('/builddefinition/3493b0493ea74c9abf78069487936c13').should.eql(true);26 });27 it('should handle permission refs', () => {28 refUtils.isRef('/projectpermission/1234u5678p1').should.eql(true);29 refUtils.isRef('/projectpermission/1234u5678p1.js').should.eql(true);30 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/projectpermission/1234u5678p1.js').should.eql(true);31 refUtils.isRef('/workspacepermission/1234u5678w1').should.eql(true);32 refUtils.isRef('/workspacepermission/1234u5678w1.js').should.eql(true);33 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/workspacepermission/1234u5678w1.js').should.eql(true);34 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/workspacepermission/1637adf8-0830-4a48-9420-fb5bdb8575d6u3497d043-3ea7-4c2c-bf78-069847936c13w1').should.eql(true);35 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/workspacepermission/1637adf808304a489420fb5bdb8575d6u3497d0433ea74c2cbf78069847936c13w1').should.eql(true);36 refUtils.isRef('/workspacepermission/1637adf8-0830-4a48-9420-fb5bdb8575d6u3497d043-3ea7-4c2c-bf78-069847936c13w1').should.eql(true);37 refUtils.isRef('/workspacepermission/1637adf808304a489420fb5bdb8575d6u3497d0433ea74c2cbf78069847936c13w1').should.eql(true);38 });39 it('should handle built-in refs', () => {40 refUtils.isRef('/typedefinition/-1234.js').should.eql(true);41 refUtils.isRef('/typedefinition/-1234').should.eql(true);42 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/-1234').should.eql(true);43 refUtils.isRef('/typedefinition/-1234/attributes').should.eql(true);44 });45 it('should handle objects', () => {46 refUtils.isRef({_ref: '/defect/12345'}).should.eql(true);47 refUtils.isRef({_ref: 'https://rally1.rallydev.com/slm/webservice/v2.0/defect/12345'}).should.eql(true);48 refUtils.isRef({_ref: 'https://rally1.rallydev.com/slm/webservice/v3.0/defect/3493b049-3ea7-4c9a-bf78-069487936c13'}).should.eql(true);49 refUtils.isRef({_ref: 'https://rally1.rallydev.com/slm/webservice/v3.0/defect/3493b0493ea74c9abf78069487936c13'}).should.eql(true);50 refUtils.isRef({_ref: '/defect/3493b049-3ea7-4c9a-bf78-069487936c13'}).should.eql(true);51 refUtils.isRef({_ref: '/defect/3493b0493ea74c9abf78069487936c13'}).should.eql(true);52 });53 it('should handle dynatype refs', () => {54 refUtils.isRef('/portfolioitem/feature/1234').should.eql(true);55 refUtils.isRef('/portfolioitem/feature/1234.js').should.eql(true);56 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/1.32/portfolioitem/feature/1234').should.eql(true);57 refUtils.isRef('http://rally1.rallydev.com/slm/webservice/1.32/portfolioitem/feature/1234.js').should.eql(true);58 refUtils.isRef('/portfolioitem/feature/1234/children.js').should.eql(true);59 refUtils.isRef('/portfolioitem/feature/1234/children').should.eql(true);60 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/1234/children').should.eql(true);61 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/portfolioitem/feature/3493b049-3ea7-4c9a-bf78-069487936c13/children').should.eql(true);62 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/portfolioitem/feature/3493b0493ea74c9abf78069487936c13/children').should.eql(true);63 refUtils.isRef('/portfolioitem/feature/3493b049-3ea7-4c9a-bf78-069487936c13/children').should.eql(true);64 refUtils.isRef('/portfolioitem/feature/3493b0493ea74c9abf78069487936c13/children').should.eql(true);65 });66 });67 describe('#getRelative', () => {68 it('should handle non-refs', () => {69 should.not.exist(refUtils.getRelative('blah'));70 should.not.exist(refUtils.getRelative(''));71 should.not.exist(refUtils.getRelative(null));72 should.not.exist(refUtils.getRelative({}));73 should.not.exist(refUtils.getRelative({_ref: null}));74 });75 it('should handle basic refs', () => {76 refUtils.getRelative('/defect/1234').should.eql('/defect/1234');77 refUtils.getRelative('/defect/1234.js').should.eql('/defect/1234');78 refUtils.getRelative('https://rally1.rallydev.com/slm/webservice/1.32/defect/1234').should.eql('/defect/1234');...
index.js
Source:index.js
...74 }75 return result;76 }77 multiple(base) {78 const isRef = Ref.isRef(base);79 if (!isRef) {80 Hoek.assert(typeof base === 'number' && isFinite(base), 'multiple must be a number');81 Hoek.assert(base > 0, 'multiple must be greater than 0');82 }83 return this._test('multiple', base, function (value, state, options) {84 const divisor = isRef ? base(state.reference || state.parent, options) : base;85 if (isRef && (typeof divisor !== 'number' || !isFinite(divisor))) {86 return this.createError('number.ref', { ref: base.key }, state, options);87 }88 if (value % divisor === 0) {89 return value;90 }91 return this.createError('number.multiple', { multiple: base, value }, state, options);92 });93 }94 integer() {95 return this._test('integer', undefined, function (value, state, options) {96 return Math.trunc(value) - value === 0 ? value : this.createError('number.integer', { value }, state, options);97 });98 }99 unsafe(enabled = true) {100 Hoek.assert(typeof enabled === 'boolean', 'enabled must be a boolean');101 if (this._flags.unsafe === enabled) {102 return this;103 }104 const obj = this.clone();105 obj._flags.unsafe = enabled;106 return obj;107 }108 negative() {109 return this._test('negative', undefined, function (value, state, options) {110 if (value < 0) {111 return value;112 }113 return this.createError('number.negative', { value }, state, options);114 });115 }116 positive() {117 return this._test('positive', undefined, function (value, state, options) {118 if (value > 0) {119 return value;120 }121 return this.createError('number.positive', { value }, state, options);122 });123 }124 precision(limit) {125 Hoek.assert(Number.isSafeInteger(limit), 'limit must be an integer');126 Hoek.assert(!('precision' in this._flags), 'precision already set');127 const obj = this._test('precision', limit, function (value, state, options) {128 const places = value.toString().match(internals.precisionRx);129 const decimals = Math.max((places[1] ? places[1].length : 0) - (places[2] ? parseInt(places[2], 10) : 0), 0);130 if (decimals <= limit) {131 return value;132 }133 return this.createError('number.precision', { limit, value }, state, options);134 });135 obj._flags.precision = limit;136 return obj;137 }138 port() {139 return this._test('port', undefined, function (value, state, options) {140 if (!Number.isSafeInteger(value) || value < 0 || value > 65535) {141 return this.createError('number.port', { value }, state, options);142 }143 return value;144 });145 }146};147internals.compare = function (type, compare) {148 return function (limit) {149 const isRef = Ref.isRef(limit);150 const isNumber = typeof limit === 'number' && !isNaN(limit);151 Hoek.assert(isNumber || isRef, 'limit must be a number or reference');152 return this._test(type, limit, function (value, state, options) {153 let compareTo;154 if (isRef) {155 compareTo = limit(state.reference || state.parent, options);156 if (!(typeof compareTo === 'number' && !isNaN(compareTo))) {157 return this.createError('number.ref', { ref: limit.key }, state, options);158 }159 }160 else {161 compareTo = limit;162 }163 if (compare(value, compareTo)) {...
historyMapper.js
Source:historyMapper.js
1module.exports = {2 LEAD: {3 collectionName: 'Opportunities',4 map: {5 isOpportunitie: {6 name : 'Is Opportunitie',7 isRef: false8 },9 'createdBy.date': {10 name : 'Creation Date',11 isRef: false12 },13 'expectedRevenue.value': {14 name : 'Amount',15 isRef: false16 },17 expectedClosing: {18 name : 'Close Date',19 isRef: false20 },21 salesPerson: {22 name : 'Person',23 isRef : true,24 collection: 'Employees',25 project : {$concat: ['$tmp.name.first', ' ', '$tmp.name.last']}26 },27 workflow: {28 name : 'workflow',29 isRef : true,30 collection: 'workflows',31 project : '$tmp.name'32 }33 }34 },35 OPPORTUNITIE: {36 collectionName: 'Opportunities',37 map: {38 isOpportunitie: {39 name : 'Is Opportunitie',40 isRef: false41 },42 'expectedRevenue.value': {43 name : 'Amount',44 isRef: false45 },46 expectedClosing: {47 name : 'Close Date',48 isRef: false49 },50 salesPerson: {51 name : 'Assigned To',52 isRef : true,53 collection: 'Employees',54 project : {$concat: ['$tmp.name.first', ' ', '$tmp.name.last']}55 },56 workflow: {57 name : 'workflow',58 isRef : true,59 collection: 'workflows',60 project : '$tmp.name'61 },62 'createdBy.date': {63 name : 'Creation Date',64 isRef: false65 }66 }67 },68 INVOICE: {69 collectionName: 'Invoice',70 map: {71 approved: {72 name : 'Approved',73 isRef: false74 },75 workflow: {76 name : 'Status',77 isRef : true,78 collection: 'workflows',79 project : '$tmp.name'80 },81 dueDate: {82 name : 'Due Date',83 isRef: false84 },85 invoiceDate: {86 name : 'Invoice Date',87 isRef: false88 },89 'createdBy.date': {90 name : 'Creation Date',91 isRef: false92 }93 }94 },95 ORDER: {96 collectionName: 'ORDER',97 map: {98 'status.fulfillStatus': {99 name : 'Fulfilled',100 isRef: false101 },102 orderDate: {103 name : 'Order Date',104 isRef: false105 },106 expectedDate: {107 name : 'Payment Due Date',108 isRef: false109 },110 workflow: {111 name : 'Status',112 isRef : true,113 collection: 'workflows',114 project : '$tmp.name'115 },116 'createdBy.date': {117 name : 'Creation Date',118 isRef: false119 }120 }121 },122 MANUFACTURINGORDER: {123 collectionName: 'manufacturingOrder',124 map: {125 'status.fulfillStatus': {126 name : 'Fulfilled',127 isRef: false128 },129 orderDate: {130 name : 'Order Date',131 isRef: false132 },133 expectedDate: {134 name : 'Payment Due Date',135 isRef: false136 },137 workflow: {138 name : 'Status',139 isRef : true,140 collection: 'workflows',141 project : '$tmp.name'142 },143 'createdBy.date': {144 name : 'Creation Date',145 isRef: false146 }147 }148 },149 PERSON: {150 collectionName: 'Persons',151 map: {152 skype: {153 name : 'Skype',154 isRef: false155 },156 'createdBy.date': {157 name : 'Creation Date',158 isRef: false159 },160 email: {161 name : 'Email',162 isRef: false163 },164 'social.LI': {165 name : 'LinkedIn',166 isRef: false167 },168 'social.FB': {169 name : 'Facebook',170 isRef: false171 },172 dateBirth: {173 name : 'Date of Birth',174 isRef: false175 },176 'name.first': {177 name : 'First Name',178 isRef: false179 },180 'name.last': {181 name : 'Last Name',182 isRef: false183 },184 jobPosition: {185 name : 'Job Position',186 isRef: false187 },188 'address.country': {189 name : 'Country',190 isRef: false191 }192 }193 },194 COMPANY: {195 collectionName: 'Companies',196 map: {197 email: {198 name : 'Email',199 isRef: false200 },201 'social.LI': {202 name : 'LinkedIn',203 isRef: false204 },205 website: {206 name : 'Website',207 isRef: false208 },209 'social.FB': {210 name : 'Facebook',211 isRef: false212 },213 'name.first': {214 name : 'Name',215 isRef: false216 },217 'address.country': {218 name : 'Country',219 isRef: false220 },221 'salesPurchases.salesPerson': {222 name : 'Assigned To',223 isRef : true,224 collection: 'Employees',225 project : {$concat: ['$tmp.name.first', ' ', '$tmp.name.last']}226 },227 'createdBy.date': {228 name : 'Creation Date',229 isRef: false230 }231 }232 },233 DEALTASK: {234 collectionName: 'DealTasks',235 map: {236 description: {237 name : 'Description',238 isRef: false239 },240 assignedTo: {241 name : 'Assigned To',242 isRef : true,243 collection: 'Employees',244 project : {$concat: ['$tmp.name.first', ' ', '$tmp.name.last']}245 },246 workflow: {247 name : 'Stage',248 isRef : true,249 collection: 'workflows',250 project : '$tmp.name'251 },252 'createdBy.date': {253 name : 'Creation Date',254 isRef: false255 }256 }257 }...
sys_dialog.js
Source:sys_dialog.js
1/**2 * JS å¼¹åºæ示3 * Created by jinhui on 2014/9/23.4 */5var icons={6 error:"error",7 loading:"loading",8 question:"question",9 succeed:"succeed",10 warning:"warning"11}12function conTip(msg){13 conTip(msg,icons.succeed,false);14}15/**16 * å计æ¶èªå¨å
³éæ示ï¼ä¸éå±ï¼17 * @param msg æ示信æ¯18 * @param icon ICONå¾æ 19 */20function conTip(msg,icon,isRef) {21 conTipLock(msg,icon,isRef,null);22}23function conTip(msg,icon,isRef,url){24 var timer;25 art.dialog({26 id: 'tipdialog',27 icon: icon,28 fixed: true,29 drag: false,30 left:'50%',31 top:'150px',32 resize: false,33 content: msg,34 ok:function(){35 if(isRef){36 if(url==null) {37 location.reload();38 }else{39 location.href=url;40 }41 }42 },43 okVal:'ç¡®å®',44 close: function () {45 if(isRef){46 if(url==null) {47 window.location.reload();48 }else{49 window.location.href=url;50 }51 }52 }53 }).show();54}55function conTipLock(msg){56 conTip(msg,icons.succeed);57}58function conTipLock(msg,icon,isRef) {59 conTipLock(msg,icon,isRef,null);60}61/**62 * å计æ¶èªå¨å
³éæ示ï¼å¸¦éå±ï¼63 * @param msg æ示信æ¯64 * @param icon ICONå¾æ 65 */66function conTipLock(msg,icon,isRef,url){67 art.dialog({68 lock: true,69 background: '#000', // èæ¯è²70 opacity: 0.66, // éæ度71 id: 'tipdialog',72 icon: icon,73 fixed: true,74 drag: false,75 left:'50%',76 top:'150px',77 resize: false,78 content: msg,79 ok:function(){80 if(isRef){81 if(url==null) {82 window.location.reload();83 }else{84 window.location.href=url;85 }86 }87 },88 okVal:'ç¡®å®',89 close: function () {90 if(isRef){91 if(url==null) {92 window.location.reload();93 }else{94 window.location.href=url;95 }96 }97 }98 }).show();99}100artDialog.prompt = function (content, yes, placeholder, value) {101 value = value || '';102 placeholder = placeholder || '';103 var input;104 return artDialog({105 id: 'Prompt',106 icon: 'question',107 fixed: true,108 lock: true,109 opacity: .1,110 content: [111 '<div style="margin-bottom:5px;font-size:12px">',112 content,113 '</div>',114 '<div>',115 '<input value="',116 value,117 '" placeholder="',118 placeholder,119 '" maxlength="6" style="width:18em;padding:3px" />',120 '</div>'121 ].join(''),122 init: function () {123 input = this.DOM.content.find('input')[0];124 input.select();125 input.focus();126 },127 ok: function (here) {128 return yes && yes.call(this, input.value, here);129 },130 cancel: true131 });132};133/*134 * 带å
³éæé®æ示135 */136function conCancel(msg){137 conCancel(msg,icons.succeed,'å
³é');138}139function conCancel(msg,btnName){140 conCancel(msg,icons.succeed,btnName);141}142/**143 * æ示信æ¯ï¼ä¸éå±ï¼144 * @param msg éè¦æ示çä¿¡æ¯145 * @param icon ICONå¾æ 146 * @param btnName å
³éæé®å称147 */148function conCancel(msg,icon,btnName){149 art.dialog({150 icon: icon,151 content: msg,152 fixed: true,153 drag: false,154 left:'50%',155 top:'150px',156 resize: false,157 cancelVal: btnName,158 cancel: true //为trueçä»·äºfunction(){}159 });160}161function conCancelLock(msg){162 conCancel(msg,icons.succeed,'å
³é');163}164function conCancelLock(msg,btnName){165 conCancel(msg,icons.succeed,btnName);166}167/**168 * æ示信æ¯ï¼å¸¦éå±ï¼169 * @param msg éè¦æ示çä¿¡æ¯170 * @param icon ICONå¾æ 171 * @param btnName å
³éæé®å称172 */173function conCancelLock(msg,icon,btnName){174 art.dialog({175 lock: true,176 background: '#000', // èæ¯è²177 opacity: 0.66, // éæ度178 icon: icon,179 fixed: true,180 drag: false,181 left:'50%',182 top:'150px',183 resize: false,184 content: msg,185 cancelVal: btnName,186 cancel: true //为trueçä»·äºfunction(){}187 });188}189/**190 * 带å享åè½æ示191 * @param msg192 * @param icon193 * @param isRef194 * @param url195 */196function tipShare(msg,icon,isRef,url){197 art.dialog({198 lock: true,199 background: '#000', // èæ¯è²200 opacity: 0.66, // éæ度201 id: 'tipdialog',202 icon: icon,203 fixed: true,204 drag: false,205 left:'50%',206 top:'150px',207 resize: false,208 content: msg,209 cancelVal: btnName,210 cancel: function(){211 if(isRef){212 if(url==null) {213 window.location.reload();214 }else{215 window.location.href=url;216 }217 }218 },219 ok:function(){220 if(isRef){221 if(url==null) {222 window.location.reload();223 }else{224 window.location.href=url;225 }226 }227 },228 okVal:'ç¡®å®',229 close: function () {230 if(isRef){231 if(url==null) {232 window.location.reload();233 }else{234 window.location.href=url;235 }236 }237 }238 }).show();...
build-in.tau.snapshot.js
Source:build-in.tau.snapshot.js
1module.exports = {types: {2 "typeMap": [3 {4 "Boolean": {5 "type": "FunctionType",6 "isRef": false,7 "isAtom": false,8 "arguments": [9 {10 "annotation": "unknown",11 "type": "ReferenceType",12 "isAtom": false,13 "isRef": true14 }15 ],16 "result": {17 "annotation": "boolean",18 "isAtom": true,19 "isRef": false,20 "type": "AtomType"21 }22 },23 "Number": {24 "type": "FunctionType",25 "isRef": false,26 "isAtom": false,27 "arguments": [28 {29 "annotation": "unknown",30 "type": "ReferenceType",31 "isAtom": false,32 "isRef": true33 }34 ],35 "result": {36 "annotation": "number",37 "isAtom": true,38 "isRef": false,39 "type": "AtomType"40 }41 },42 "String": {43 "type": "FunctionType",44 "isRef": false,45 "isAtom": false,46 "arguments": [47 {48 "annotation": "unknown",49 "type": "ReferenceType",50 "isAtom": false,51 "isRef": true52 }53 ],54 "result": {55 "annotation": "string",56 "isAtom": true,57 "isRef": false,58 "type": "AtomType"59 }60 },61 "console": {62 "type": "ObjectType",63 "isRef": false,64 "isAtom": false,65 "annotation": {66 "log": {67 "type": "FunctionType",68 "isRef": false,69 "isAtom": false,70 "arguments": [71 {72 "annotation": "unknown",73 "type": "ReferenceType",74 "isAtom": false,75 "isRef": true76 }77 ]78 },79 "assert": {80 "type": "FunctionType",81 "isRef": false,82 "isAtom": false,83 "arguments": [84 {85 "annotation": "boolean",86 "isAtom": true,87 "isRef": false,88 "type": "AtomType"89 },90 {91 "annotation": "unknown",92 "type": "ReferenceType",93 "isAtom": false,94 "isRef": true95 }96 ]97 }98 }99 },100 "Math": {101 "type": "ObjectType",102 "isRef": false,103 "isAtom": false,104 "annotation": {105 "random": {106 "type": "FunctionType",107 "isRef": false,108 "isAtom": false,109 "arguments": [],110 "result": {111 "annotation": "number",112 "isAtom": true,113 "isRef": false,114 "type": "AtomType"115 }116 },117 "floor": {118 "type": "FunctionType",119 "isRef": false,120 "isAtom": false,121 "arguments": [122 {123 "annotation": "number",124 "isAtom": true,125 "isRef": false,126 "type": "AtomType"127 }128 ],129 "result": {130 "annotation": "number",131 "isAtom": true,132 "isRef": false,133 "type": "AtomType"134 }135 }136 }137 }138 }139 ]...
utils.js
Source:utils.js
1export const Utils = {2 isType(target, type) {3 let targetType = Object.prototype.toString.call(target).slice(8, -1).toLowerCase();4 return targetType === type.toLowerCase();5 },6 hasClass: function (target, className, isRef) {7 let classNames = isRef ? target : target.className || '';8 return (' ' + classNames + ' ').indexOf(' ' + className + ' ') === -1;9 },10 addClass: function (target, className, isRef) {11 let classNames = isRef ? target : target.className || '';12 if (this.hasClass(target, className, isRef)) {13 target.className = classNames ? classNames + ' ' + className : className;14 }15 },16 removeClass: function (target, className, isRef) {17 let classNames = isRef ? target : target.className || '';18 target.className = (' ' + classNames + ' ').replace(' ' + className + ' ', ' ').trim();19 },...
resolver-test.js
Source:resolver-test.js
...6fail = buster.fail;7buster.testCase('lib/resolver', {8 'isRef': {9 'should allow own $ref': function() {10 assert(new Resolver().isRef({ $ref: '' }));11 },12 'should not allow inherited $ref': function() {13 refute(new Resolver().isRef(Object.create({ $ref: '' })));14 },15 'should not allow missing $ref': function() {16 refute(new Resolver().isRef({}));17 },18 'should not allow null': function() {19 refute(new Resolver().isRef(null));20 refute(new Resolver().isRef());21 }22 }23});24})(25 require('buster'),26 require('../../../lib/resolver')...
Using AI Code Generation
1const wptools = require('wptools');2const wptools = require('wptools');3const wptools = require('wptools');4const wptools = require('wptools');5const wptools = require('wptools');6const wptools = require('wptools');7const wptools = require('wptools');8const wptools = require('wptools');9const wptools = require('wptools');10const wptools = require('wptools');11const wptools = require('wptools');12const wptools = require('wptools');
Using AI Code Generation
1var wptools = require('wptools');2var page = wptools.page('Barack Obama');3page.isRef(function(err, isRef) {4 console.log(isRef);5});6var wptools = require('wptools');7var page = wptools.page('Barack Obama');8page.isRef(function(err, isRef) {9 console.log(isRef);10});11var wptools = require('wptools');12var page = wptools.page('Barack Obama');13page.isRedirect(function(err, isRedirect) {14 console.log(isRedirect);15});16var wptools = require('wptools');17var page = wptools.page('Barack Obama');18page.isRedirect(function(err, isRedirect) {19 console.log(isRedirect);20});21var wptools = require('wptools');22var page = wptools.page('Barack Obama');23page.isStub(function(err, isStub) {24 console.log(isStub);25});26var wptools = require('wptools');27var page = wptools.page('Barack Obama');28page.isStub(function(err, isStub) {29 console.log(isStub);30});31var wptools = require('wptools');32var page = wptools.page('Barack Obama');33page.isTalk(function(err, isTalk) {34 console.log(isTalk);35});36var wptools = require('wptools');37var page = wptools.page('Barack Obama');38page.isTalk(function(err, isTalk) {39 console.log(isTalk);40});
Using AI Code Generation
1var wptools = require('wptools');2var page = wptools.page('Barack Obama');3page.isRef(function(err, isRef){4 console.log(isRef);5});6var wptools = require('wptools');7var page = wptools.page('Barack Obama');8page.isRef(function(err, isRef){9 console.log(isRef);10});11var wptools = require('wptools');12var page = wptools.page('Barack Obama');13page.isRef(function(err, isRef){14 console.log(isRef);15});16var wptools = require('wptools');17var page = wptools.page('Barack Obama');18page.isRef(function(err, isRef){19 console.log(isRef);20});21var wptools = require('wptools');22var page = wptools.page('Barack Obama');23page.isRef(function(err, isRef){24 console.log(isRef);25});26var wptools = require('wptools');27var page = wptools.page('Barack Obama');28page.isRef(function(err, isRef){29 console.log(isRef);30});31var wptools = require('wptools');32var page = wptools.page('Barack Obama');33page.isRef(function(err, isRef){34 console.log(isRef);35});36var wptools = require('wptools');
Using AI Code Generation
1var wptools = require('wptools');2var wiki = wptools.page('Albert Einstein');3wiki.get(function(err, resp) {4 console.log(resp.isRef('birth_date'));5});6var wptools = require('wptools');7var wiki = wptools.page('Albert Einstein');8wiki.get(function(err, resp) {9 console.log(resp.isRef('birth_date'));10});11var wptools = require('wptools');12var wiki = wptools.page('Albert Einstein');13wiki.get(function(err, resp) {14 console.log(resp.isRef('birth_date'));15});16var wptools = require('wptools');17var wiki = wptools.page('Albert Einstein');18wiki.get(function(err, resp) {19 console.log(resp.isRef('birth_date'));20});21var wptools = require('wptools');22var wiki = wptools.page('Albert Einstein');23wiki.get(function(err, resp) {24 console.log(resp.isRef('birth_date'));25});26var wptools = require('wptools');27var wiki = wptools.page('Albert Einstein');28wiki.get(function(err, resp) {29 console.log(resp.isRef('birth_date'));30});31var wptools = require('wptools');32var wiki = wptools.page('Albert Einstein');33wiki.get(function(err, resp) {34 console.log(resp.isRef('birth_date'));35});
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!