BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e7a6531b
Unverified
Commit
e7a6531b
authored
Jan 18, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move archived component to vue file
parent
d7c7061a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
37 deletions
+58
-37
mr_widget_archived.vue
...e_request_widget/components/states/mr_widget_archived.vue
+29
-24
dependencies.js
...sets/javascripts/vue_merge_request_widget/dependencies.js
+1
-1
index.js
app/assets/javascripts/vue_merge_request_widget/index.js
+3
-0
mr_widget_archived_spec.js
...ue_mr_widget/components/states/mr_widget_archived_spec.js
+25
-12
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_archived.
js
→
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_archived.
vue
View file @
e7a6531b
import
statusIcon
from
'../mr_widget_status_icon'
;
<
script
>
import
statusIcon
from
'../mr_widget_status_icon'
;
export
default
{
name
:
'MRWidgetArchived'
,
components
:
{
statusIcon
,
},
template
:
`
<div class="mr-widget-body media">
<div class="space-children">
<status-icon status="failed" />
<button
type="button"
class="btn btn-success btn-sm"
disabled="true">
Merge
</button>
</div>
<div class="media-body">
<span class="bold">
This project is archived, write access has been disabled
</span>
</div>
export
default
{
name
:
'MRWidgetArchived'
,
components
:
{
statusIcon
,
},
};
</
script
>
<
template
>
<div
class=
"mr-widget-body media"
>
<div
class=
"space-children"
>
<status-icon
status=
"failed"
/>
<button
type=
"button"
class=
"btn btn-success btn-sm"
disabled=
"true"
>
{{
s__
(
"mrWidget|Merge"
)
}}
</button>
</div>
`
,
};
<div
class=
"media-body"
>
<span
class=
"bold"
>
{{
s__
(
"mrWidget|This project is archived, write access has been disabled"
)
}}
</span>
</div>
</div>
</
template
>
app/assets/javascripts/vue_merge_request_widget/dependencies.js
View file @
e7a6531b
...
...
@@ -21,7 +21,7 @@ export { default as FailedToMerge } from './components/states/mr_widget_failed_t
export
{
default
as
ClosedState
}
from
'./components/states/mr_widget_closed'
;
export
{
default
as
MergingState
}
from
'./components/states/mr_widget_merging'
;
export
{
default
as
WipState
}
from
'./components/states/mr_widget_wip'
;
export
{
default
as
ArchivedState
}
from
'./components/states/mr_widget_archived'
;
export
{
default
as
ArchivedState
}
from
'./components/states/mr_widget_archived
.vue
'
;
export
{
default
as
ConflictsState
}
from
'./components/states/mr_widget_conflicts'
;
export
{
default
as
NothingToMergeState
}
from
'./components/states/mr_widget_nothing_to_merge'
;
export
{
default
as
MissingBranchState
}
from
'./components/states/mr_widget_missing_branch'
;
...
...
app/assets/javascripts/vue_merge_request_widget/index.js
View file @
e7a6531b
...
...
@@ -2,6 +2,9 @@ import {
Vue
,
mrWidgetOptions
,
}
from
'./dependencies'
;
import
Translate
from
'../vue_shared/translate'
;
Vue
.
use
(
Translate
);
document
.
addEventListener
(
'DOMContentLoaded'
,
()
=>
{
gl
.
mrWidgetData
.
gitlabLogo
=
gon
.
gitlab_logo
;
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_archived_spec.js
View file @
e7a6531b
import
Vue
from
'vue'
;
import
archivedComponent
from
'~/vue_merge_request_widget/components/states/mr_widget_archived'
;
import
archivedComponent
from
'~/vue_merge_request_widget/components/states/mr_widget_archived.vue'
;
import
mountComponent
from
'../../../helpers/vue_mount_component_helper'
;
describe
(
'MRWidgetArchived'
,
()
=>
{
describe
(
'template'
,
()
=>
{
it
(
'should have correct elements'
,
()
=>
{
const
Component
=
Vue
.
extend
(
archivedComponent
);
const
el
=
new
Component
({
el
:
document
.
createElement
(
'div'
),
}).
$el
;
let
vm
;
expect
(
el
.
classList
.
contains
(
'mr-widget-body'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'button'
).
classList
.
contains
(
'btn-success'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'button'
).
disabled
).
toBeTruthy
();
expect
(
el
.
innerText
).
toContain
(
'This project is archived, write access has been disabled'
);
});
beforeEach
(()
=>
{
const
Component
=
Vue
.
extend
(
archivedComponent
);
vm
=
mountComponent
(
Component
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'renders a ci status failed icon'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'.ci-status-icon'
)).
not
.
toBeNull
();
});
it
(
'renders a disabled button'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'button'
).
getAttribute
(
'disabled'
)).
toEqual
(
'disabled'
);
expect
(
vm
.
$el
.
querySelector
(
'button'
).
textContent
.
trim
()).
toEqual
(
'Merge'
);
});
it
(
'renders information'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'.bold'
).
textContent
.
trim
(),
).
toEqual
(
'This project is archived, write access has been disabled'
);
});
});
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