Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2019-06-11 07:15:08 +0300
committerSimon Knox <psimyn@gmail.com>2019-06-14 16:57:05 +0300
commit14f27102b696672f02b5d1b2ab45688b711f4024 (patch)
treeeef48bb1366b20a961e6aa4bb61bc357dc77d1c9 /spec
parent577832598f1b35187efafc426068ef7ac36ae09f (diff)
Add Join meeting button to Issues with Zoom links
Detect links containing zoom.us followed by j, s, or my Add link below Issue title that links to Zoom meeting
Diffstat (limited to 'spec')
-rw-r--r--spec/features/issues/user_creates_issue_spec.rb13
-rw-r--r--spec/frontend/issue_show/components/pinned_links_spec.js91
2 files changed, 104 insertions, 0 deletions
diff --git a/spec/features/issues/user_creates_issue_spec.rb b/spec/features/issues/user_creates_issue_spec.rb
index 0f604db870f..2789d574156 100644
--- a/spec/features/issues/user_creates_issue_spec.rb
+++ b/spec/features/issues/user_creates_issue_spec.rb
@@ -92,6 +92,19 @@ describe "User creates issue" do
.and have_content(label_titles.first)
end
end
+
+ context "with Zoom link" do
+ it "adds Zoom button" do
+ issue_title = "Issue containing Zoom meeting link"
+ zoom_url = "https://gitlab.zoom.us/j/123456789"
+
+ fill_in("Title", with: issue_title)
+ fill_in("Description", with: zoom_url)
+ click_button("Submit issue")
+
+ expect(page).to have_link('Join Zoom meeting', href: zoom_url)
+ end
+ end
end
context "when signed in as user with special characters in their name" do
diff --git a/spec/frontend/issue_show/components/pinned_links_spec.js b/spec/frontend/issue_show/components/pinned_links_spec.js
new file mode 100644
index 00000000000..50041667a61
--- /dev/null
+++ b/spec/frontend/issue_show/components/pinned_links_spec.js
@@ -0,0 +1,91 @@
+import { shallowMount, createLocalVue } from '@vue/test-utils';
+import { GlLink } from '@gitlab/ui';
+import PinnedLinks from '~/issue_show/components/pinned_links.vue';
+
+const localVue = createLocalVue();
+
+const plainZoomUrl = 'https://zoom.us/j/123456789';
+const vanityZoomUrl = 'https://gitlab.zoom.us/j/123456789';
+const startZoomUrl = 'https://zoom.us/s/123456789';
+const personalZoomUrl = 'https://zoom.us/my/hunter-zoloman';
+const randomUrl = 'https://zoom.us.com';
+
+describe('PinnedLinks', () => {
+ let wrapper;
+
+ const link = {
+ get text() {
+ return wrapper.find(GlLink).text();
+ },
+ get href() {
+ return wrapper.find(GlLink).attributes('href');
+ },
+ };
+
+ const createComponent = props => {
+ wrapper = shallowMount(localVue.extend(PinnedLinks), {
+ localVue,
+ sync: false,
+ propsData: {
+ descriptionHtml: '',
+ ...props,
+ },
+ });
+ };
+
+ it('displays Zoom link', () => {
+ createComponent({
+ descriptionHtml: `<a href="${plainZoomUrl}">Zoom</a>`,
+ });
+
+ expect(link.text).toBe('Join Zoom meeting');
+ });
+
+ it('detects plain Zoom link', () => {
+ createComponent({
+ descriptionHtml: `<a href="${plainZoomUrl}">Zoom</a>`,
+ });
+
+ expect(link.href).toBe(plainZoomUrl);
+ });
+
+ it('detects vanity Zoom link', () => {
+ createComponent({
+ descriptionHtml: `<a href="${vanityZoomUrl}">Zoom</a>`,
+ });
+
+ expect(link.href).toBe(vanityZoomUrl);
+ });
+
+ it('detects Zoom start meeting link', () => {
+ createComponent({
+ descriptionHtml: `<a href="${startZoomUrl}">Zoom</a>`,
+ });
+
+ expect(link.href).toBe(startZoomUrl);
+ });
+
+ it('detects personal Zoom room link', () => {
+ createComponent({
+ descriptionHtml: `<a href="${personalZoomUrl}">Zoom</a>`,
+ });
+
+ expect(link.href).toBe(personalZoomUrl);
+ });
+
+ it('only renders final Zoom link in description', () => {
+ createComponent({
+ descriptionHtml: `<a href="${plainZoomUrl}">Zoom</a><a href="${vanityZoomUrl}">Zoom</a>`,
+ });
+
+ expect(link.href).toBe(vanityZoomUrl);
+ });
+
+ it('does not render for other links', () => {
+ createComponent({
+ descriptionHtml: `<a href="${randomUrl}">Some other link</a>`,
+ });
+
+ expect(wrapper.find(GlLink).exists()).toBe(false);
+ });
+});