-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathnested-drag-drop.e2e.js
29 lines (27 loc) · 1.48 KB
/
nested-drag-drop.e2e.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
describe('nested drag and drop', () => {
it('should have correct model after moving between lists', () => {
browser.get('http://localhost:8080/nested.html')
browser.executeScript('$("#item2").simulate("drag-n-drop", { dragTarget: $("#item3"), interpolation: {stepWidth: 2, stepDelay: 30}});')
browser.sleep(1000)
element(by.id('main-list')).evaluate('$ctrl.lastDragged.name').then(function(value){
expect(value).toBe('item2');
})
browser.executeScript('$("#item3").simulate("drag-n-drop", { dragTarget: $("#subitem1"), interpolation: {stepWidth: 2, stepDelay: 30}});')
browser.sleep(1000)
element(by.id('main-list')).evaluate('$ctrl.lastDragged.name').then(function(value){
expect(value).toBe('item3');
})
browser.executeScript('$("#item1").simulate("drag-n-drop", { dragTarget: $("#item2"), interpolation: {stepWidth: 2, stepDelay: 30}});')
browser.sleep(1000)
element(by.id('main-list')).evaluate('$ctrl.lastDragged.name').then(function(value){
expect(value).toBe('item1');
})
})
it('should allow list with nested list to be dropped in a nested list', () => {
browser.get('http://localhost:8080/nested.html')
browser.executeAsyncScript('var done = arguments[0]; window.onerror = done; $("#item2").simulate("drag-n-drop", { dragTarget: $("#subitem1"), interpolation: {stepWidth: 2, stepDelay: 30}}); setTimeout(done, 1000)').then(response =>{
expect(response).toBeFalsy()
})
browser.sleep(1000)
})
})