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
1533cf10
Commit
1533cf10
authored
Jan 31, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves merge help into a vue component
parent
bebb9c0c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
60 deletions
+63
-60
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_merge_help.js
...e_merge_request_widget/components/mr_widget_merge_help.js
+0
-23
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_merge_help.vue
..._merge_request_widget/components/mr_widget_merge_help.vue
+39
-0
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.js
...uest_widget/components/states/mr_widget_missing_branch.js
+1
-1
app/assets/javascripts/vue_merge_request_widget/dependencies.js
...sets/javascripts/vue_merge_request_widget/dependencies.js
+1
-1
spec/javascripts/vue_mr_widget/components/mr_widget_merge_help_spec.js
...pts/vue_mr_widget/components/mr_widget_merge_help_spec.js
+22
-35
No files found.
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_merge_help.js
deleted
100644 → 0
View file @
bebb9c0c
export
default
{
name
:
'
MRWidgetMergeHelp
'
,
props
:
{
missingBranch
:
{
type
:
String
,
required
:
false
,
default
:
''
},
},
template
:
`
<section class="mr-widget-help">
<template
v-if="missingBranch">
If the {{missingBranch}} branch exists in your local repository, you
</template>
<template v-else>
You
</template>
can merge this merge request manually using the
<a
data-toggle="modal"
href="#modal_merge_info">
command line
</a>
</section>
`
,
};
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_merge_help.vue
0 → 100644
View file @
1533cf10
<
script
>
import
{
sprintf
,
s__
}
from
'
~/locale
'
;
export
default
{
name
:
'
MRWidgetMergeHelp
'
,
props
:
{
missingBranch
:
{
type
:
String
,
required
:
false
,
default
:
''
},
},
computed
:
{
missingBranchInfo
()
{
return
sprintf
(
s__
(
'
mrWidget|If the %{branch} branch exists in your local repository, you can merge this merge request manually using the
'
),
{
branch
:
this
.
missingBranch
}
);
},
},
};
</
script
>
<
template
>
<section
class=
"mr-widget-help"
>
<template
v-if=
"missingBranch"
>
{{
missingBranchInfo
}}
</
template
>
<
template
v-else
>
{{
s__
(
"
mrWidget|You can merge this merge request manually using the
"
)
}}
</
template
>
<a
role=
"button"
data-toggle=
"modal"
href=
"#modal_merge_info"
>
{{ s__("mrWidget|command line") }}
</a>
</section>
</template>
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.js
View file @
1533cf10
import
statusIcon
from
'
../mr_widget_status_icon.vue
'
;
import
statusIcon
from
'
../mr_widget_status_icon.vue
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
import
mrWidgetMergeHelp
from
'
../../components/mr_widget_merge_help
'
;
import
mrWidgetMergeHelp
from
'
../../components/mr_widget_merge_help
.vue
'
;
export
default
{
export
default
{
name
:
'
MRWidgetMissingBranch
'
,
name
:
'
MRWidgetMissingBranch
'
,
...
...
app/assets/javascripts/vue_merge_request_widget/dependencies.js
View file @
1533cf10
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
export
{
default
as
Vue
}
from
'
vue
'
;
export
{
default
as
Vue
}
from
'
vue
'
;
export
{
default
as
SmartInterval
}
from
'
~/smart_interval
'
;
export
{
default
as
SmartInterval
}
from
'
~/smart_interval
'
;
export
{
default
as
WidgetHeader
}
from
'
./components/mr_widget_header
'
;
export
{
default
as
WidgetHeader
}
from
'
./components/mr_widget_header
'
;
export
{
default
as
WidgetMergeHelp
}
from
'
./components/mr_widget_merge_help
'
;
export
{
default
as
WidgetMergeHelp
}
from
'
./components/mr_widget_merge_help
.vue
'
;
export
{
default
as
WidgetPipeline
}
from
'
./components/mr_widget_pipeline.vue
'
;
export
{
default
as
WidgetPipeline
}
from
'
./components/mr_widget_pipeline.vue
'
;
export
{
default
as
WidgetDeployment
}
from
'
./components/mr_widget_deployment
'
;
export
{
default
as
WidgetDeployment
}
from
'
./components/mr_widget_deployment
'
;
export
{
default
as
WidgetRelatedLinks
}
from
'
./components/mr_widget_related_links
'
;
export
{
default
as
WidgetRelatedLinks
}
from
'
./components/mr_widget_related_links
'
;
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_merge_help_spec.js
View file @
1533cf10
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mergeHelpComponent
from
'
~/vue_merge_request_widget/components/mr_widget_merge_help
'
;
import
mergeHelpComponent
from
'
~/vue_merge_request_widget/components/mr_widget_merge_help.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
const
props
=
{
missingBranch
:
'
this-is-not-the-branch-you-are-looking-for
'
,
};
const
text
=
`If the
${
props
.
missingBranch
}
branch exists in your local repository`
;
const
createComponent
=
()
=>
{
const
text
=
`If the
${
props
.
missingBranch
}
branch exists in your local repository`
;
const
Component
=
Vue
.
extend
(
mergeHelpComponent
);
return
new
Component
({
el
:
document
.
createElement
(
'
div
'
),
propsData
:
props
,
});
};
describe
(
'
MRWidgetMergeHelp
'
,
()
=>
{
describe
(
'
MRWidgetMergeHelp
'
,
()
=>
{
describe
(
'
props
'
,
()
=>
{
let
vm
;
it
(
'
should have props
'
,
()
=>
{
let
Component
;
const
{
missingBranch
}
=
mergeHelpComponent
.
props
;
const
MissingBranchTypeClass
=
missingBranch
.
type
;
expect
(
new
MissingBranchTypeClass
()
instanceof
String
).
toBeTruthy
();
beforeEach
(()
=>
{
expect
(
missingBranch
.
required
).
toBeFalsy
();
Component
=
Vue
.
extend
(
mergeHelpComponent
);
expect
(
missingBranch
.
default
).
toEqual
(
''
);
});
});
});
describe
(
'
template
'
,
()
=>
{
afterEach
(
()
=>
{
let
vm
;
vm
.
$destroy
()
;
let
el
;
})
;
fdescribe
(
'
with missing branch
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
=
createComponent
();
vm
=
mountComponent
(
Component
,
{
el
=
vm
.
$el
;
missingBranch
:
'
this-is-not-the-branch-you-are-looking-for
'
,
});
});
it
(
'
should have the correct elements
'
,
()
=>
{
expect
(
el
.
classList
.
contains
(
'
mr-widget-help
'
)).
toBeTruthy
();
expect
(
el
.
textContent
).
toContain
(
text
);
});
});
it
(
'
should not show missing branch name if missingBranch props is not provided
'
,
(
done
)
=>
{
it
(
'
renders missing branch information
'
,
()
=>
{
vm
.
missingBranch
=
null
;
console
.
log
(
''
,
vm
.
$el
);
Vue
.
nextTick
(()
=>
{
expect
(
el
.
textContent
).
not
.
toContain
(
text
);
done
();
});
});
});
});
describe
(
'
without missing branch
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
);
});
});
});
});
});
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