Best JavaScript code snippet using devicefarmer-stf
DragDrop.js
Source:DragDrop.js
...10 dataType: 'json',11 success: function (data) {12 $('#storypool').append($t.parent().addClass('draggable'));13 $t.remove();14 bindDraggable();15 },16 error: function () {17 alert('error');18 return;19 }20 });21 });22 }23 function bindDraggable() {24 $(".draggable").draggable({25 revert: "invalid",26 cursorAt: { cursor: "crosshair", top: -5, left: -5 },27 start: function () {28 $(this).addClass("being-dragged"); // change the dimensions to make the draggable fit29 },30 stop: function () {31 $(this).removeClass("being-dragged");32 }33 });34 }35 $(".droppable").droppable({36 accept: ".draggable",37 drop: function (event, ui) {38 // here we assing the story to a release39 var storyId = $(ui.draggable).attr('storyid');40 var storyName = $(ui.draggable, 'h2');41 var storyDesc = $(ui.draggable, 'p');42 console.log(storyName.html());43 var releaseId = $(this).attr('releaseid');44 $.ajax({45 type: 'POST',46 url: '/Release/Ajax',47 data: { 'releaseId': releaseId, 'storyId': storyId },48 dataType: 'json',49 success: function (data) {50 $('[releaseid=' + releaseId + '] ul.inner-list').append('<li storyid="' + storyId + '">' + storyName.html() + '<a href="#" class="removelink" onclick="return false;">X</a></li>');51 $(ui.draggable).remove();52 //rebind53 bindRemove();54 bindDraggable();55 },56 error: function () {57 alert('error');58 }59 });60 }61 });62 bindRemove();63 bindDraggable();...
angular-packery-directive.js
Source:angular-packery-directive.js
...17 }, parsedAttrs)18 var pckry = new PackeryService(container, options)19 pckry.on('layoutComplete', onLayoutComplete)20 pckry.bindResize()21 bindDraggable()22 $timeout(function() {23 pckry.layout()24 }, 0)25 $timeout(function() {26 pckry.layout()27 }, 100)28 function bindDraggable() {29 if (options.draggable) {30 var draggableOptions = {}31 if (options.draggableHandle) {32 draggableOptions.handle = options.draggableHandle33 }34 var itemElems = pckry.getItemElements()35 for (var i = 0, len = itemElems.length; i < len; ++i) {36 var elem = itemElems[i]37 var draggie = new DraggabillyService(elem, draggableOptions)38 pckry.bindDraggabillyEvents(draggie)39 }40 }41 }42 function onLayoutComplete() {...
index.ts
Source:index.ts
2import './assets/index.scss';3const file: HTMLElement | null = document.getElementById('file');4const file2: HTMLElement | null = document.getElementById('file2');5if(file && file2) {6 bindDraggable(file);7 bindDraggable(file2);8}9export {10 bindDraggable...
Using AI Code Generation
1var devicefarmer = require('devicefarmer-stf');2device.on('ready', function() {3 console.log('Device is ready');4});5device.on('error', function(err) {6 console.log('Device error: ' + err);7});8device.on('disconnect', function() {9 console.log('Device disconnected');10});11device.connect('
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!!