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
Jérome Perrin
gitlab-ce
Commits
6adb6cae
Commit
6adb6cae
authored
Jan 25, 2017
by
Phil Hughes
Committed by
Fatih Acet
Feb 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started tests
parent
240d8c8d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
242 additions
and
33 deletions
+242
-33
app/assets/javascripts/boards/boards_bundle.js.es6
app/assets/javascripts/boards/boards_bundle.js.es6
+4
-5
app/assets/javascripts/boards/components/modal/dismiss.js.es6
...assets/javascripts/boards/components/modal/dismiss.js.es6
+1
-1
app/assets/javascripts/boards/components/modal/footer.js.es6
app/assets/javascripts/boards/components/modal/footer.js.es6
+1
-1
app/assets/javascripts/boards/components/modal/header.js.es6
app/assets/javascripts/boards/components/modal/header.js.es6
+3
-3
app/assets/javascripts/boards/components/modal/index.js.es6
app/assets/javascripts/boards/components/modal/index.js.es6
+2
-2
app/assets/javascripts/boards/components/modal/list.js.es6
app/assets/javascripts/boards/components/modal/list.js.es6
+1
-1
app/assets/javascripts/boards/components/modal/lists_dropdown.js.es6
...javascripts/boards/components/modal/lists_dropdown.js.es6
+2
-1
app/assets/javascripts/boards/components/modal/search.js.es6
app/assets/javascripts/boards/components/modal/search.js.es6
+1
-1
app/assets/javascripts/boards/components/modal/tabs.js.es6
app/assets/javascripts/boards/components/modal/tabs.js.es6
+1
-1
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+0
-9
app/assets/javascripts/boards/stores/modal_store.js.es6
app/assets/javascripts/boards/stores/modal_store.js.es6
+16
-8
spec/features/boards/add_issues_modal_spec.rb
spec/features/boards/add_issues_modal_spec.rb
+210
-0
No files found.
app/assets/javascripts/boards/boards_bundle.js.es6
View file @
6adb6cae
...
@@ -14,12 +14,13 @@
...
@@ -14,12 +14,13 @@
//= require ./components/board
//= require ./components/board
//= require ./components/board_sidebar
//= require ./components/board_sidebar
//= require ./components/new_list_dropdown
//= require ./components/new_list_dropdown
//= require ./components/modal/
modal
//= require ./components/modal/
index
//= require ./vue_resource_interceptor
//= require ./vue_resource_interceptor
$(() => {
$(() => {
const $boardApp = document.getElementById('board-app');
const $boardApp = document.getElementById('board-app');
const Store = gl.issueBoards.BoardsStore;
const Store = gl.issueBoards.BoardsStore;
const ModalStore = gl.issueBoards.ModalStore;
window.gl = window.gl || {};
window.gl = window.gl || {};
...
@@ -73,10 +74,8 @@ $(() => {
...
@@ -73,10 +74,8 @@ $(() => {
this.loading = false;
this.loading = false;
if (this.state.lists.length > 0) {
if (this.state.lists.length > 0) {
Store.modal
.selectedList = this.state.lists[0];
ModalStore.store
.selectedList = this.state.lists[0];
}
}
Store.modal.showAddIssuesModal = true;
});
});
}
}
});
});
...
@@ -97,6 +96,6 @@ $(() => {
...
@@ -97,6 +96,6 @@ $(() => {
.on('click', '.js-show-add-issues', (e) => {
.on('click', '.js-show-add-issues', (e) => {
e.preventDefault();
e.preventDefault();
Store.modal
.showAddIssuesModal = true;
ModalStore.store
.showAddIssuesModal = true;
});
});
});
});
app/assets/javascripts/boards/components/modal/dismiss.js.es6
View file @
6adb6cae
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
gl.issueBoards.DismissModal = Vue.extend({
gl.issueBoards.DismissModal = Vue.extend({
data() {
data() {
return ModalStore.
globalS
tore;
return ModalStore.
s
tore;
},
},
methods: {
methods: {
toggleModal(toggle) {
toggleModal(toggle) {
...
...
app/assets/javascripts/boards/components/modal/footer.js.es6
View file @
6adb6cae
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
gl.issueBoards.ModalFooter = Vue.extend({
gl.issueBoards.ModalFooter = Vue.extend({
data() {
data() {
return ModalStore.
globalS
tore;
return ModalStore.
s
tore;
},
},
computed: {
computed: {
submitDisabled() {
submitDisabled() {
...
...
app/assets/javascripts/boards/components/modal/header.js.es6
View file @
6adb6cae
/
/= require ./dismiss
/
* global Vue */
//= require ./tabs
//= require ./tabs
//= require ./dismiss
//= require ./search
//= require ./search
/* global Vue */
(() => {
(() => {
const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
gl.issueBoards.IssuesModalHeader = Vue.extend({
gl.issueBoards.IssuesModalHeader = Vue.extend({
data() {
data() {
return ModalStore.
globalS
tore;
return ModalStore.
s
tore;
},
},
components: {
components: {
'modal-dismiss': gl.issueBoards.DismissModal,
'modal-dismiss': gl.issueBoards.DismissModal,
...
...
app/assets/javascripts/boards/components/modal/
modal
.es6
→
app/assets/javascripts/boards/components/modal/
index.js
.es6
View file @
6adb6cae
/* global Vue */
//= require ./header
//= require ./header
//= require ./list
//= require ./list
//= require ./footer
//= require ./footer
/* global Vue */
(() => {
(() => {
const ModalStore = gl.issueBoards.ModalStore;
const ModalStore = gl.issueBoards.ModalStore;
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
gl.issueBoards.IssuesModal = Vue.extend({
gl.issueBoards.IssuesModal = Vue.extend({
data() {
data() {
return ModalStore.
globalS
tore;
return ModalStore.
s
tore;
},
},
watch: {
watch: {
searchTerm() {
searchTerm() {
...
...
app/assets/javascripts/boards/components/modal/list.js.es6
View file @
6adb6cae
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
gl.issueBoards.ModalList = Vue.extend({
gl.issueBoards.ModalList = Vue.extend({
data() {
data() {
return ModalStore.
globalS
tore;
return ModalStore.
s
tore;
},
},
watch: {
watch: {
activeTab() {
activeTab() {
...
...
app/assets/javascripts/boards/components/modal/lists_dropdown.js.es6
View file @
6adb6cae
/* global Vue */
/* global Vue */
(() => {
(() => {
const ModalStore = gl.issueBoards.ModalStore;
const Store = gl.issueBoards.BoardsStore;
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl = window.gl || {};
...
@@ -8,7 +9,7 @@
...
@@ -8,7 +9,7 @@
gl.issueBoards.ModalFooterListsDropdown = Vue.extend({
gl.issueBoards.ModalFooterListsDropdown = Vue.extend({
data() {
data() {
return {
return {
modal:
Store.modal
,
modal:
ModalStore.store
,
state: Store.state,
state: Store.state,
};
};
},
},
...
...
app/assets/javascripts/boards/components/modal/search.js.es6
View file @
6adb6cae
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
gl.issueBoards.ModalSearch = Vue.extend({
gl.issueBoards.ModalSearch = Vue.extend({
data() {
data() {
return ModalStore.
globalS
tore;
return ModalStore.
s
tore;
},
},
computed: {
computed: {
selectAllText() {
selectAllText() {
...
...
app/assets/javascripts/boards/components/modal/tabs.js.es6
View file @
6adb6cae
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
gl.issueBoards.ModalTabs = Vue.extend({
gl.issueBoards.ModalTabs = Vue.extend({
data() {
data() {
return ModalStore.
globalS
tore;
return ModalStore.
s
tore;
},
},
methods: {
methods: {
changeTab(tab) {
changeTab(tab) {
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
View file @
6adb6cae
...
@@ -12,15 +12,6 @@
...
@@ -12,15 +12,6 @@
detail: {
detail: {
issue: {}
issue: {}
},
},
modal: {
issues: [],
selectedIssues: [],
showAddIssuesModal: false,
activeTab: 'all',
selectedList: {},
searchTerm: '',
loading: false,
},
moving: {
moving: {
issue: {},
issue: {},
list: {}
list: {}
...
...
app/assets/javascripts/boards/stores/modal_store.js.es6
View file @
6adb6cae
...
@@ -4,11 +4,19 @@
...
@@ -4,11 +4,19 @@
class ModalStore {
class ModalStore {
constructor() {
constructor() {
this.globalStore = gl.issueBoards.BoardsStore.modal;
this.store = {
issues: [],
selectedIssues: [],
showAddIssuesModal: false,
activeTab: 'all',
selectedList: {},
searchTerm: '',
loading: false,
};
}
}
selectedCount() {
selectedCount() {
return this.
globalS
tore.selectedIssues.length;
return this.
s
tore.selectedIssues.length;
}
}
toggleIssue(issueObj) {
toggleIssue(issueObj) {
...
@@ -23,9 +31,9 @@
...
@@ -23,9 +31,9 @@
}
}
toggleAll() {
toggleAll() {
const select = this.selectedCount() !== this.
globalS
tore.issues.length;
const select = this.selectedCount() !== this.
s
tore.issues.length;
this.
globalS
tore.issues.forEach((issue) => {
this.
s
tore.issues.forEach((issue) => {
const issueUpdate = issue;
const issueUpdate = issue;
if (issueUpdate.selected !== select) {
if (issueUpdate.selected !== select) {
...
@@ -41,20 +49,20 @@
...
@@ -41,20 +49,20 @@
}
}
addSelectedIssue(issue) {
addSelectedIssue(issue) {
this.
globalS
tore.selectedIssues.push(issue);
this.
s
tore.selectedIssues.push(issue);
}
}
removeSelectedIssue(issue) {
removeSelectedIssue(issue) {
const index = this.selectedIssueIndex(issue);
const index = this.selectedIssueIndex(issue);
this.
globalS
tore.selectedIssues.splice(index, 1);
this.
s
tore.selectedIssues.splice(index, 1);
}
}
selectedIssueIndex(issue) {
selectedIssueIndex(issue) {
return this.
globalS
tore.selectedIssues.indexOf(issue);
return this.
s
tore.selectedIssues.indexOf(issue);
}
}
findSelectedIssue(issue) {
findSelectedIssue(issue) {
return this.
globalS
tore.selectedIssues
return this.
s
tore.selectedIssues
.filter(filteredIssue => filteredIssue.id === issue.id)[0];
.filter(filteredIssue => filteredIssue.id === issue.id)[0];
}
}
}
}
...
...
spec/features/boards/add_issues_modal_spec.rb
0 → 100644
View file @
6adb6cae
require
'rails_helper'
describe
'Issue Boards add issue modal'
,
:feature
,
:js
do
include
WaitForAjax
include
WaitForVueResource
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:planning
)
{
create
(
:label
,
project:
project
,
name:
'Planning'
)
}
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
planning
,
position:
0
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
visit
namespace_project_board_path
(
project
.
namespace
,
project
,
board
)
wait_for_vue_resource
end
context
'modal interaction'
do
it
'opens modal'
do
click_button
(
'Add issues'
)
expect
(
page
).
to
have_selector
(
'.add-issues-modal'
)
end
it
'closes modal'
do
click_button
(
'Add issues'
)
page
.
within
(
'.add-issues-modal'
)
do
find
(
'.close'
).
click
end
expect
(
page
).
not_to
have_selector
(
'.add-issues-modal'
)
end
it
'closes modal if cancel button clicked'
do
click_button
(
'Add issues'
)
page
.
within
(
'.add-issues-modal'
)
do
click_button
'Cancel'
end
expect
(
page
).
not_to
have_selector
(
'.add-issues-modal'
)
end
end
context
'issues list'
do
before
do
click_button
(
'Add issues'
)
wait_for_vue_resource
end
it
'loads issues'
do
page
.
within
(
'.add-issues-modal'
)
do
page
.
within
(
'.nav-links'
)
do
expect
(
page
).
to
have_content
(
'2'
)
end
expect
(
page
).
to
have_selector
(
'.card'
,
count:
2
)
end
end
it
'shows selected issues'
do
page
.
within
(
'.add-issues-modal'
)
do
click_link
'Selected issues'
expect
(
page
).
not_to
have_selector
(
'.card'
)
end
end
context
'search'
do
it
'returns issues'
do
page
.
within
(
'.add-issues-modal'
)
do
find
(
'.form-control'
).
native
.
send_keys
(
issue
.
title
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
end
end
it
'returns no issues'
do
page
.
within
(
'.add-issues-modal'
)
do
find
(
'.form-control'
).
native
.
send_keys
(
'testing search'
)
expect
(
page
).
not_to
have_selector
(
'.card'
)
end
end
end
context
'selecing issues'
do
it
'selects single issue'
do
page
.
within
(
'.add-issues-modal'
)
do
first
(
'.card'
).
click
page
.
within
(
'.nav-links'
)
do
expect
(
page
).
to
have_content
(
'Selected issues 1'
)
end
end
end
it
'changes button text'
do
page
.
within
(
'.add-issues-modal'
)
do
first
(
'.card'
).
click
expect
(
first
(
'.add-issues-footer .btn'
)).
to
have_content
(
'Add 1 issue'
)
end
end
it
'changes button text with plural'
do
page
.
within
(
'.add-issues-modal'
)
do
all
(
'.card'
).
each
do
|
el
|
el
.
click
end
expect
(
first
(
'.add-issues-footer .btn'
)).
to
have_content
(
'Add 2 issues'
)
end
end
it
'shows only selected issues on selected tab'
do
page
.
within
(
'.add-issues-modal'
)
do
first
(
'.card'
).
click
click_link
'Selected issues'
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
end
end
it
'selects all issues'
do
page
.
within
(
'.add-issues-modal'
)
do
click_button
'Select all'
expect
(
page
).
to
have_selector
(
'.is-active'
,
count:
2
)
end
end
it
'un-selects all issues'
do
page
.
within
(
'.add-issues-modal'
)
do
click_button
'Select all'
expect
(
page
).
to
have_selector
(
'.is-active'
,
count:
2
)
click_button
'Un-select all'
expect
(
page
).
not_to
have_selector
(
'.is-active'
)
end
end
it
'selects all that arent already selected'
do
page
.
within
(
'.add-issues-modal'
)
do
first
(
'.card'
).
click
expect
(
page
).
to
have_selector
(
'.is-active'
,
count:
1
)
click_button
'Select all'
expect
(
page
).
to
have_selector
(
'.is-active'
,
count:
2
)
end
end
it
'unselects from selected tab'
do
page
.
within
(
'.add-issues-modal'
)
do
first
(
'.card'
).
click
click_link
'Selected issues'
first
(
'.card'
).
click
expect
(
page
).
not_to
have_selector
(
'.card'
)
end
end
end
context
'adding issues'
do
it
'adds to board'
do
page
.
within
(
'.add-issues-modal'
)
do
first
(
'.card'
).
click
click_button
'Add 1 issue'
end
page
.
within
(
first
(
'.board'
))
do
expect
(
page
).
to
have_selector
(
'.card'
)
end
end
it
'adds to second list'
do
page
.
within
(
'.add-issues-modal'
)
do
first
(
'.card'
).
click
click_button
planning
.
title
click_link
label
.
title
click_button
'Add 1 issue'
end
page
.
within
(
find
(
'.board:nth-child(2)'
))
do
expect
(
page
).
to
have_selector
(
'.card'
)
end
end
end
end
end
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