diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-19 15:07:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-19 15:07:15 +0300 |
commit | ba55ca9bc4bf2c85d2d78fcb11552ad130151110 (patch) | |
tree | 8a205191235a5b2b29e5eaacf9224c73052dddc9 /spec/frontend/users_select | |
parent | ee3d5f16e3aa642944b121645764e33604a31307 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/users_select')
-rw-r--r-- | spec/frontend/users_select/index_spec.js | 5 | ||||
-rw-r--r-- | spec/frontend/users_select/test_helper.js | 10 |
2 files changed, 6 insertions, 9 deletions
diff --git a/spec/frontend/users_select/index_spec.js b/spec/frontend/users_select/index_spec.js index 3757e63c4f9..dc6918ee543 100644 --- a/spec/frontend/users_select/index_spec.js +++ b/spec/frontend/users_select/index_spec.js @@ -1,4 +1,5 @@ import { escape } from 'lodash'; +import htmlCeMrSingleAssignees from 'test_fixtures/merge_requests/merge_request_with_single_assignee_feature.html'; import UsersSelect from '~/users_select/index'; import { createInputsModelExpectation, @@ -15,9 +16,7 @@ import { } from './test_helper'; describe('~/users_select/index', () => { - const context = createTestContext({ - fixturePath: 'merge_requests/merge_request_with_single_assignee_feature.html', - }); + const context = createTestContext({ fixture: htmlCeMrSingleAssignees }); beforeEach(() => { context.setup(); diff --git a/spec/frontend/users_select/test_helper.js b/spec/frontend/users_select/test_helper.js index 6fb3436100f..b38400446a9 100644 --- a/spec/frontend/users_select/test_helper.js +++ b/spec/frontend/users_select/test_helper.js @@ -1,18 +1,16 @@ import MockAdapter from 'axios-mock-adapter'; import { memoize, cloneDeep } from 'lodash'; import usersFixture from 'test_fixtures/autocomplete/users.json'; -import { getFixture } from 'helpers/fixtures'; import waitForPromises from 'helpers/wait_for_promises'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_OK } from '~/lib/utils/http_status'; import UsersSelect from '~/users_select'; // fixtures ------------------------------------------------------------------- -const getUserSearchHTML = memoize((fixturePath) => { - const html = getFixture(fixturePath); +const getUserSearchHTML = memoize((fixture) => { const parser = new DOMParser(); - const el = parser.parseFromString(html, 'text/html').querySelector('.assignee'); + const el = parser.parseFromString(fixture, 'text/html').querySelector('.assignee'); return el.outerHTML; }); @@ -22,13 +20,13 @@ const getUsersFixture = () => usersFixture; export const getUsersFixtureAt = (idx) => getUsersFixture()[idx]; // test context --------------------------------------------------------------- -export const createTestContext = ({ fixturePath }) => { +export const createTestContext = ({ fixture }) => { let mock = null; let subject = null; const setup = () => { const rootEl = document.createElement('div'); - rootEl.innerHTML = getUserSearchHTML(fixturePath); + rootEl.innerHTML = getUserSearchHTML(fixture); document.body.appendChild(rootEl); mock = new MockAdapter(axios); |