Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
8d0ddbdb
Commit
8d0ddbdb
authored
Aug 16, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated rspec to not use sleep when dragging
Fixed JS tests
parent
dc73405d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
17 deletions
+20
-17
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+4
-2
app/assets/javascripts/boards/test_utils/simulate_drag.js
app/assets/javascripts/boards/test_utils/simulate_drag.js
+2
-0
spec/features/boards/boards_spec.rb
spec/features/boards/boards_spec.rb
+4
-1
spec/javascripts/boards/boards_store_spec.js.es6
spec/javascripts/boards/boards_store_spec.js.es6
+10
-14
No files found.
app/assets/javascripts/boards/stores/boards_store.js.es6
View file @
8d0ddbdb
...
...
@@ -71,8 +71,8 @@
welcomeIsHidden () {
return $.cookie('issue_board_welcome_hidden') === 'true';
},
removeList (id) {
const list = this.findList('id', id,
'blank'
);
removeList (id
, type = 'blank'
) {
const list = this.findList('id', id,
type
);
if (!list) return;
...
...
@@ -107,6 +107,8 @@
list.removeIssue(issue);
}
issue.removeLabels(listLabels);
} else {
listFrom.removeIssue(issue);
}
},
findList (key, val, type = 'label') {
...
...
app/assets/javascripts/boards/test_utils/simulate_drag.js
View file @
8d0ddbdb
...
...
@@ -84,6 +84,7 @@
var
duration
=
options
.
duration
||
1000
;
simulateEvent
(
fromEl
,
'
mousedown
'
,
{
button
:
0
});
options
.
ontap
&&
options
.
ontap
();
window
.
SIMULATE_DRAG_ACTIVE
=
1
;
var
dragInterval
=
setInterval
(
function
loop
()
{
var
progress
=
(
new
Date
().
getTime
()
-
startTime
)
/
duration
;
...
...
@@ -100,6 +101,7 @@
options
.
ondragend
&&
options
.
ondragend
();
simulateEvent
(
toEl
,
'
mouseup
'
);
clearInterval
(
dragInterval
);
window
.
SIMULATE_DRAG_ACTIVE
=
0
;
}
},
100
);
...
...
spec/features/boards/boards_spec.rb
View file @
8d0ddbdb
...
...
@@ -508,6 +508,9 @@ describe 'Issue Boards', feature: true, js: true do
def
drag_to
(
list_from_index:
0
,
card_index:
0
,
to_index:
0
,
list_to_index:
0
,
selector:
'.board-list'
)
evaluate_script
(
"simulateDrag({scrollable: document.getElementById('board-app'), from: {el: $('
#{
selector
}
').eq(
#{
list_from_index
}
).get(0), index:
#{
card_index
}
}, to: {el: $('.board-list').eq(
#{
list_to_index
}
).get(0), index:
#{
to_index
}
}});"
)
sleep
1
Timeout
.
timeout
(
Capybara
.
default_max_wait_time
)
do
loop
until
page
.
evaluate_script
(
'window.SIMULATE_DRAG_ACTIVE'
).
zero?
end
end
end
spec/javascripts/boards/boards_store_spec.js.es6
View file @
8d0ddbdb
...
...
@@ -125,39 +125,35 @@
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(1);
gl.issueBoards.BoardsStore.removeList(1);
gl.issueBoards.BoardsStore.removeList(1
, 'label'
);
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(0);
});
it('moves the position of lists', () => {
gl.issueBoards.BoardsStore.addList(listObj);
gl.issueBoards.BoardsStore.addList(listObjDuplicate);
const listOne = gl.issueBoards.BoardsStore.addList(listObj),
listTwo =
gl.issueBoards.BoardsStore.addList(listObjDuplicate);
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(2);
gl.issueBoards.BoardsStore.moveList(
0, 1
);
gl.issueBoards.BoardsStore.moveList(
listOne, ['2', '1']
);
const list = gl.issueBoards.BoardsStore.findList('id', 1);
expect(list.position).toBe(1);
expect(listOne.position).toBe(1);
});
it('moves an issue from one list to another', (done) => {
gl.issueBoards.BoardsStore.addList(listObj);
gl.issueBoards.BoardsStore.addList(listObjDuplicate);
const listOne = gl.issueBoards.BoardsStore.addList(listObj),
listTwo =
gl.issueBoards.BoardsStore.addList(listObjDuplicate);
expect(gl.issueBoards.BoardsStore.state.lists.length).toBe(2);
const list = gl.issueBoards.BoardsStore.findList('id', 1),
listTwo = gl.issueBoards.BoardsStore.findList('id', 2);
setTimeout(() => {
expect(list.issues.length).toBe(1);
expect(list
One
.issues.length).toBe(1);
expect(listTwo.issues.length).toBe(1);
gl.issueBoards.BoardsStore.moveIssueToList(
1, 2, 1
);
gl.issueBoards.BoardsStore.moveIssueToList(
listOne, listTwo, listOne.findIssue(1)
);
expect(list.issues.length).toBe(0);
expect(list
One
.issues.length).toBe(0);
expect(listTwo.issues.length).toBe(1);
done();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment