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
89f3be09
Commit
89f3be09
authored
Feb 19, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests for new components
parent
373b8c26
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
2 deletions
+171
-2
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
...ets/javascripts/ide/components/commit_sidebar/actions.vue
+4
-1
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
...javascripts/ide/components/commit_sidebar/radio_group.vue
+2
-1
spec/javascripts/repo/components/commit_sidebar/actions_spec.js
...avascripts/repo/components/commit_sidebar/actions_spec.js
+35
-0
spec/javascripts/repo/components/commit_sidebar/radio_group_spec.js
...cripts/repo/components/commit_sidebar/radio_group_spec.js
+130
-0
No files found.
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
View file @
89f3be09
...
...
@@ -18,6 +18,9 @@
...
mapState
([
'
currentBranchId
'
,
]),
newMergeRequestHelpText
()
{
return
`Creates a new branch from
${
this
.
currentBranchId
}
and re-directs to create a new merge request`
;
},
},
};
</
script
>
...
...
@@ -43,7 +46,7 @@
:value=
"COMMIT_TO_NEW_BRANCH_MR"
label=
"Create a new branch and merge request"
:show-input=
"true"
:help-text=
"
`Creates a new branch from $
{currentBranchId} and re-directs to create a new merge request`
"
:help-text=
"
newMergeRequestHelpText
"
/>
</div>
</
template
>
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
View file @
89f3be09
...
...
@@ -30,7 +30,7 @@
type
:
String
,
required
:
false
,
default
:
null
,
}
}
,
},
computed
:
{
...
mapState
(
'
commit
'
,
[
...
...
@@ -43,6 +43,7 @@
methods
:
{
...
mapActions
(
'
commit
'
,
[
'
updateCommitAction
'
,
'
updateBranchName
'
,
]),
},
};
...
...
spec/javascripts/repo/components/commit_sidebar/actions_spec.js
0 → 100644
View file @
89f3be09
import
Vue
from
'
vue
'
;
import
store
from
'
~/ide/stores
'
;
import
commitActions
from
'
~/ide/components/commit_sidebar/actions.vue
'
;
import
{
createComponentWithStore
}
from
'
../../../helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../../helpers
'
;
describe
(
'
IDE commit sidebar actions
'
,
()
=>
{
let
vm
;
beforeEach
((
done
)
=>
{
const
Component
=
Vue
.
extend
(
commitActions
);
vm
=
createComponentWithStore
(
Component
,
store
);
vm
.
$store
.
state
.
currentBranchId
=
'
master
'
;
vm
.
$mount
();
Vue
.
nextTick
(
done
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
resetStore
(
vm
.
$store
);
});
it
(
'
renders 3 groups
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
input[type="radio"]
'
).
length
).
toBe
(
3
);
});
it
(
'
renders current branch text
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Commit to master branch
'
);
});
});
spec/javascripts/repo/components/commit_sidebar/radio_group_spec.js
0 → 100644
View file @
89f3be09
import
Vue
from
'
vue
'
;
import
store
from
'
~/ide/stores
'
;
import
radioGroup
from
'
~/ide/components/commit_sidebar/radio_group.vue
'
;
import
{
createComponentWithStore
}
from
'
../../../helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
../../helpers
'
;
describe
(
'
IDE commit sidebar radio group
'
,
()
=>
{
let
vm
;
beforeEach
((
done
)
=>
{
const
Component
=
Vue
.
extend
(
radioGroup
);
store
.
state
.
commit
.
commitAction
=
'
2
'
;
vm
=
createComponentWithStore
(
Component
,
store
,
{
value
:
'
1
'
,
label
:
'
test
'
,
checked
:
true
,
});
vm
.
$mount
();
Vue
.
nextTick
(
done
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
resetStore
(
vm
.
$store
);
});
it
(
'
uses label if present
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
test
'
);
});
it
(
'
uses slot if label is not present
'
,
(
done
)
=>
{
vm
.
$destroy
();
vm
=
new
Vue
({
components
:
{
radioGroup
,
},
store
,
template
:
`
<radio-group
value="1"
>
Testing slot
</radio-group>
`
,
});
vm
.
$mount
();
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Testing slot
'
);
done
();
});
});
it
(
'
updates store when changing radio button
'
,
(
done
)
=>
{
vm
.
$el
.
querySelector
(
'
input
'
).
dispatchEvent
(
new
Event
(
'
change
'
));
Vue
.
nextTick
(()
=>
{
expect
(
store
.
state
.
commit
.
commitAction
).
toBe
(
'
1
'
);
done
();
});
});
it
(
'
renders helpText tooltip
'
,
(
done
)
=>
{
vm
.
helpText
=
'
help text
'
;
Vue
.
nextTick
(()
=>
{
const
help
=
vm
.
$el
.
querySelector
(
'
.help-block
'
);
expect
(
help
).
not
.
toBeNull
();
expect
(
help
.
getAttribute
(
'
data-original-title
'
)).
toBe
(
'
help text
'
);
done
();
});
});
describe
(
'
with input
'
,
()
=>
{
beforeEach
((
done
)
=>
{
vm
.
$destroy
();
const
Component
=
Vue
.
extend
(
radioGroup
);
store
.
state
.
commit
.
commitAction
=
'
1
'
;
vm
=
createComponentWithStore
(
Component
,
store
,
{
value
:
'
1
'
,
label
:
'
test
'
,
checked
:
true
,
showInput
:
true
,
});
vm
.
$mount
();
Vue
.
nextTick
(
done
);
});
it
(
'
renders input box when commitAction matches value
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.form-control
'
)).
not
.
toBeNull
();
});
it
(
'
hides input when commitAction doesnt match value
'
,
(
done
)
=>
{
store
.
state
.
commit
.
commitAction
=
'
2
'
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.form-control
'
)).
toBeNull
();
done
();
});
});
it
(
'
updates branch name in store on input
'
,
(
done
)
=>
{
const
input
=
vm
.
$el
.
querySelector
(
'
.form-control
'
);
input
.
value
=
'
testing-123
'
;
input
.
dispatchEvent
(
new
Event
(
'
input
'
));
Vue
.
nextTick
(()
=>
{
expect
(
store
.
state
.
commit
.
newBranchName
).
toBe
(
'
testing-123
'
);
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