summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-17 21:09:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-17 21:09:20 +0000
commit06be418a7cd98a1c87c41ba43cca1ce9acbe885e (patch)
tree218a068630ae2dbe87b32a67a7f2b77d631e0db9 /spec/javascripts
parenteb1f5a3e087b7d6a3e85f2724b5a475cc9d9d37d (diff)
downloadgitlab-ce-06be418a7cd98a1c87c41ba43cca1ce9acbe885e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/user_popovers_spec.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/javascripts/user_popovers_spec.js b/spec/javascripts/user_popovers_spec.js
index b3def474957..6ac22fca2d3 100644
--- a/spec/javascripts/user_popovers_spec.js
+++ b/spec/javascripts/user_popovers_spec.js
@@ -2,10 +2,10 @@ import initUserPopovers from '~/user_popovers';
import UsersCache from '~/lib/utils/users_cache';
describe('User Popovers', () => {
- const fixtureTemplate = 'merge_requests/diff_comment.html';
+ const fixtureTemplate = 'merge_requests/merge_request_with_mentions.html';
preloadFixtures(fixtureTemplate);
- const selector = '.js-user-link';
+ const selector = '.js-user-link, .gfm-project_member';
const dummyUser = { name: 'root' };
const dummyUserStatus = { message: 'active' };
@@ -34,8 +34,12 @@ describe('User Popovers', () => {
popovers = initUserPopovers(document.querySelectorAll(selector));
});
- it('initializes a popover for each js-user-link element found in the document', () => {
- expect(document.querySelectorAll(selector).length).toBe(popovers.length);
+ it('initializes a popover for each user link with a user id', () => {
+ const linksWithUsers = Array.from(document.querySelectorAll(selector)).filter(
+ ({ dataset }) => dataset.user || dataset.userId,
+ );
+
+ expect(linksWithUsers.length).toBe(popovers.length);
});
it('does not initialize the user popovers twice for the same element', () => {