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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
8d8de87a
Commit
8d8de87a
authored
Oct 07, 2021
by
sstern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable create list button after clicked once
Changelog: changed
parent
e755595e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
4 deletions
+83
-4
app/assets/javascripts/boards/components/board_add_new_column_trigger.vue
...cripts/boards/components/board_add_new_column_trigger.vue
+21
-4
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/boards/components/board_add_new_column_trigger_spec.js
...nd/boards/components/board_add_new_column_trigger_spec.js
+59
-0
No files found.
app/assets/javascripts/boards/components/board_add_new_column_trigger.vue
View file @
8d8de87a
<
script
>
<
script
>
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
mapActions
}
from
'
vuex
'
;
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
__
}
from
'
~/locale
'
;
import
Tracking
from
'
~/tracking
'
;
import
Tracking
from
'
~/tracking
'
;
export
default
{
export
default
{
components
:
{
components
:
{
GlButton
,
GlButton
,
},
},
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
mixins
:
[
Tracking
.
mixin
()],
mixins
:
[
Tracking
.
mixin
()],
computed
:
{
...
mapState
({
isNewListShowing
:
({
addColumnForm
})
=>
addColumnForm
.
visible
}),
tooltip
()
{
return
this
.
isNewListShowing
?
__
(
'
The list creation wizard is already open
'
)
:
''
;
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
setAddColumnFormVisibility
'
]),
...
mapActions
([
'
setAddColumnFormVisibility
'
]),
handleClick
()
{
handleClick
()
{
...
@@ -19,7 +29,14 @@ export default {
...
@@ -19,7 +29,14 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"gl-ml-3 gl-display-flex gl-align-items-center"
data-testid=
"boards-create-list"
>
<div
<gl-button
variant=
"confirm"
@
click=
"handleClick"
>
{{
__
(
'
Create list
'
)
}}
</gl-button>
v-gl-tooltip=
"tooltip"
:tabindex=
"isNewListShowing ? '0' : undefined"
class=
"gl-ml-3 gl-display-flex gl-align-items-center"
data-testid=
"boards-create-list"
>
<gl-button
:disabled=
"isNewListShowing"
variant=
"confirm"
@
click=
"handleClick"
>
{{
__
(
'
Create list
'
)
}}
</gl-button>
</div>
</div>
</
template
>
</
template
>
locale/gitlab.pot
View file @
8d8de87a
...
@@ -34029,6 +34029,9 @@ msgstr ""
...
@@ -34029,6 +34029,9 @@ msgstr ""
msgid "The license was successfully uploaded and will be active from %{starts_at}. You can see the details below."
msgid "The license was successfully uploaded and will be active from %{starts_at}. You can see the details below."
msgstr ""
msgstr ""
msgid "The list creation wizard is already open"
msgstr ""
msgid "The maximum file size allowed is %{size}."
msgid "The maximum file size allowed is %{size}."
msgstr ""
msgstr ""
...
...
spec/frontend/boards/components/board_add_new_column_trigger_spec.js
0 → 100644
View file @
8d8de87a
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
mountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
BoardAddNewColumnTrigger
from
'
~/boards/components/board_add_new_column_trigger.vue
'
;
import
{
createStore
}
from
'
~/boards/stores
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
Vue
.
use
(
Vuex
);
describe
(
'
BoardAddNewColumnTrigger
'
,
()
=>
{
let
wrapper
;
const
findBoardsCreateList
=
()
=>
wrapper
.
findByTestId
(
'
boards-create-list
'
);
const
findTooltipText
=
()
=>
getBinding
(
findBoardsCreateList
().
element
,
'
gl-tooltip
'
);
const
mountComponent
=
()
=>
{
wrapper
=
mountExtended
(
BoardAddNewColumnTrigger
,
{
directives
:
{
GlTooltip
:
createMockDirective
(),
},
store
:
createStore
(),
});
};
beforeEach
(()
=>
{
mountComponent
();
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
describe
(
'
when button is active
'
,
()
=>
{
it
(
'
does not show the tooltip
'
,
()
=>
{
const
tooltip
=
findTooltipText
();
expect
(
tooltip
.
value
).
toBe
(
''
);
});
it
(
'
renders an enabled button
'
,
()
=>
{
const
button
=
wrapper
.
find
(
GlButton
);
expect
(
button
.
props
(
'
disabled
'
)).
toBe
(
false
);
});
});
describe
(
'
when button is disabled
'
,
()
=>
{
it
(
'
shows the tooltip
'
,
async
()
=>
{
wrapper
.
find
(
GlButton
).
vm
.
$emit
(
'
click
'
);
await
wrapper
.
vm
.
$nextTick
();
const
tooltip
=
findTooltipText
();
expect
(
tooltip
.
value
).
toBe
(
'
The list creation wizard is already open
'
);
});
});
});
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