summaryrefslogtreecommitdiff
path: root/spec/frontend
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-09 21:07:57 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-09 21:07:57 +0000
commit5aa96ff14229dba7e35f213354963febf3ad2833 (patch)
tree544f3233c05f7f1aa723ea9f13036f2f45d91745 /spec/frontend
parent7ebcead8cfd2edb810dd0cbda816b6cfbd170fe3 (diff)
downloadgitlab-ce-5aa96ff14229dba7e35f213354963febf3ad2833.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/vue_shared/components/gl_mentions_spec.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/gl_mentions_spec.js b/spec/frontend/vue_shared/components/gl_mentions_spec.js
new file mode 100644
index 00000000000..32fc055a77d
--- /dev/null
+++ b/spec/frontend/vue_shared/components/gl_mentions_spec.js
@@ -0,0 +1,34 @@
+import { shallowMount } from '@vue/test-utils';
+import Tribute from 'tributejs';
+import GlMentions from '~/vue_shared/components/gl_mentions.vue';
+
+describe('GlMentions', () => {
+ let wrapper;
+
+ describe('Tribute', () => {
+ const mentions = '/gitlab-org/gitlab-test/-/autocomplete_sources/members?type=Issue&type_id=1';
+
+ beforeEach(() => {
+ wrapper = shallowMount(GlMentions, {
+ propsData: {
+ dataSources: {
+ mentions,
+ },
+ },
+ slots: {
+ default: ['<input/>'],
+ },
+ });
+ });
+
+ it('is set to tribute instance variable', () => {
+ expect(wrapper.vm.tribute instanceof Tribute).toBe(true);
+ });
+
+ it('contains the slot input element', () => {
+ wrapper.find('input').setValue('@');
+
+ expect(wrapper.vm.tribute.current.element).toBe(wrapper.find('input').element);
+ });
+ });
+});