diff options
Diffstat (limited to 'spec/frontend')
13 files changed, 80 insertions, 41 deletions
diff --git a/spec/frontend/fixtures/raw.rb b/spec/frontend/fixtures/raw.rb index cf51f2389bc..44927bd29d8 100644 --- a/spec/frontend/fixtures/raw.rb +++ b/spec/frontend/fixtures/raw.rb @@ -25,6 +25,10 @@ RSpec.describe 'Raw files', '(JavaScript fixtures)' do @blob = project.repository.blob_at('6d85bb69', 'files/ipython/basic.ipynb') end + it 'blob/notebook/markdown-table.json' do + @blob = project.repository.blob_at('f6b7a707', 'files/ipython/markdown-table.ipynb') + end + it 'blob/notebook/worksheets.json' do @blob = project.repository.blob_at('6d85bb69', 'files/ipython/worksheets.ipynb') end diff --git a/spec/frontend/monitoring/components/dashboards_dropdown_spec.js b/spec/frontend/monitoring/components/dashboards_dropdown_spec.js index c9241834789..589354e7849 100644 --- a/spec/frontend/monitoring/components/dashboards_dropdown_spec.js +++ b/spec/frontend/monitoring/components/dashboards_dropdown_spec.js @@ -6,7 +6,7 @@ import DashboardsDropdown from '~/monitoring/components/dashboards_dropdown.vue' import { dashboardGitResponse } from '../mock_data'; -const defaultBranch = 'master'; +const defaultBranch = 'main'; const starredDashboards = dashboardGitResponse.filter(({ starred }) => starred); const notStarredDashboards = dashboardGitResponse.filter(({ starred }) => !starred); diff --git a/spec/frontend/monitoring/components/duplicate_dashboard_form_spec.js b/spec/frontend/monitoring/components/duplicate_dashboard_form_spec.js index 51b4106d4b1..0dd3afd7c83 100644 --- a/spec/frontend/monitoring/components/duplicate_dashboard_form_spec.js +++ b/spec/frontend/monitoring/components/duplicate_dashboard_form_spec.js @@ -16,7 +16,7 @@ const createMountedWrapper = (props = {}) => { }; describe('DuplicateDashboardForm', () => { - const defaultBranch = 'master'; + const defaultBranch = 'main'; const findByRef = (ref) => wrapper.find({ ref }); const setValue = (ref, val) => { diff --git a/spec/frontend/monitoring/components/duplicate_dashboard_modal_spec.js b/spec/frontend/monitoring/components/duplicate_dashboard_modal_spec.js index 1bc89e509b5..7e7a7a66d77 100644 --- a/spec/frontend/monitoring/components/duplicate_dashboard_modal_spec.js +++ b/spec/frontend/monitoring/components/duplicate_dashboard_modal_spec.js @@ -37,7 +37,7 @@ describe('duplicate dashboard modal', () => { return shallowMount(DuplicateDashboardModal, { propsData: { - defaultBranch: 'master', + defaultBranch: 'main', modalId: 'id', }, store, diff --git a/spec/frontend/monitoring/mock_data.js b/spec/frontend/monitoring/mock_data.js index 29a7c86491d..00be5868ba3 100644 --- a/spec/frontend/monitoring/mock_data.js +++ b/spec/frontend/monitoring/mock_data.js @@ -15,7 +15,7 @@ const customDashboardsData = new Array(30).fill(null).map((_, idx) => ({ can_edit: true, system_dashboard: false, out_of_the_box_dashboard: false, - project_blob_path: `${mockProjectDir}/blob/master/dashboards/.gitlab/dashboards/dashboard_${idx}.yml`, + project_blob_path: `${mockProjectDir}/blob/main/dashboards/.gitlab/dashboards/dashboard_${idx}.yml`, path: `.gitlab/dashboards/dashboard_${idx}.yml`, starred: false, })); @@ -32,7 +32,7 @@ export const anomalyDeploymentData = [ iid: 3, sha: 'f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', ref: { - name: 'master', + name: 'main', }, created_at: '2019-08-19T22:00:00.000Z', deployed_at: '2019-08-19T22:01:00.000Z', @@ -44,7 +44,7 @@ export const anomalyDeploymentData = [ iid: 2, sha: 'f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', ref: { - name: 'master', + name: 'main', }, created_at: '2019-08-19T23:00:00.000Z', deployed_at: '2019-08-19T23:00:00.000Z', @@ -61,7 +61,7 @@ export const deploymentData = [ commitUrl: 'http://test.host/frontend-fixtures/environments-project/-/commit/f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', ref: { - name: 'master', + name: 'main', }, created_at: '2019-07-16T10:14:25.589Z', tag: false, @@ -75,7 +75,7 @@ export const deploymentData = [ commitUrl: 'http://test.host/frontend-fixtures/environments-project/-/commit/f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187', ref: { - name: 'master', + name: 'main', }, created_at: '2019-07-16T11:14:25.589Z', tag: false, @@ -187,7 +187,7 @@ export const dashboardGitResponse = [ can_edit: true, system_dashboard: false, out_of_the_box_dashboard: false, - project_blob_path: `${mockProjectDir}/-/blob/master/.gitlab/dashboards/dashboard.yml`, + project_blob_path: `${mockProjectDir}/-/blob/main/.gitlab/dashboards/dashboard.yml`, path: '.gitlab/dashboards/dashboard.yml', starred: true, user_starred_path: `${mockProjectDir}/metrics_user_starred_dashboards?dashboard_path=.gitlab/dashboards/dashboard.yml`, @@ -224,7 +224,7 @@ export const selfMonitoringDashboardGitResponse = [ can_edit: true, system_dashboard: false, out_of_the_box_dashboard: false, - project_blob_path: `${mockProjectDir}/-/blob/master/.gitlab/dashboards/dashboard.yml`, + project_blob_path: `${mockProjectDir}/-/blob/main/.gitlab/dashboards/dashboard.yml`, path: '.gitlab/dashboards/dashboard.yml', starred: true, user_starred_path: `${mockProjectDir}/metrics_user_starred_dashboards?dashboard_path=.gitlab/dashboards/dashboard.yml`, @@ -572,7 +572,7 @@ export const storeVariables = [ ]; export const dashboardHeaderProps = { - defaultBranch: 'master', + defaultBranch: 'main', isRearrangingPanels: false, selectedTimeRange: { start: '2020-01-01T00:00:00.000Z', @@ -581,7 +581,7 @@ export const dashboardHeaderProps = { }; export const dashboardActionsMenuProps = { - defaultBranch: 'master', + defaultBranch: 'main', addingMetricsAvailable: true, customMetricsPath: 'https://path/to/customMetrics', validateQueryPath: 'https://path/to/validateQuery', diff --git a/spec/frontend/notebook/cells/markdown_spec.js b/spec/frontend/notebook/cells/markdown_spec.js index 219d74595bd..d250ffed1a9 100644 --- a/spec/frontend/notebook/cells/markdown_spec.js +++ b/spec/frontend/notebook/cells/markdown_spec.js @@ -27,7 +27,7 @@ describe('Markdown component', () => { return vm.$nextTick(); }); - it('does not render promot', () => { + it('does not render prompt', () => { expect(vm.$el.querySelector('.prompt span')).toBeNull(); }); @@ -50,6 +50,41 @@ describe('Markdown component', () => { expect(vm.$el.querySelector('a').getAttribute('href')).toBeNull(); }); + describe('tables', () => { + beforeEach(() => { + json = getJSONFixture('blob/notebook/markdown-table.json'); + }); + + it('renders images and text', () => { + vm = new Component({ + propsData: { + cell: json.cells[0], + }, + }).$mount(); + + return vm.$nextTick().then(() => { + const images = vm.$el.querySelectorAll('img'); + expect(images.length).toBe(5); + + const columns = vm.$el.querySelectorAll('td'); + expect(columns.length).toBe(6); + + expect(columns[0].textContent).toEqual('Hello '); + expect(columns[1].textContent).toEqual('Test '); + expect(columns[2].textContent).toEqual('World '); + expect(columns[3].textContent).toEqual('Fake '); + expect(columns[4].textContent).toEqual('External image: '); + expect(columns[5].textContent).toEqual('Empty'); + + expect(columns[0].innerHTML).toContain('<img src="data:image/jpeg;base64'); + expect(columns[1].innerHTML).toContain('<img src="data:image/png;base64'); + expect(columns[2].innerHTML).toContain('<img src="data:image/jpeg;base64'); + expect(columns[3].innerHTML).toContain('<img>'); + expect(columns[4].innerHTML).toContain('<img src="https://www.google.com/'); + }); + }); + }); + describe('katex', () => { beforeEach(() => { json = getJSONFixture('blob/notebook/math.json'); diff --git a/spec/frontend/repository/components/table/index_spec.js b/spec/frontend/repository/components/table/index_spec.js index af263f43d7d..e9e51abaf0f 100644 --- a/spec/frontend/repository/components/table/index_spec.js +++ b/spec/frontend/repository/components/table/index_spec.js @@ -55,8 +55,8 @@ describe('Repository table component', () => { it.each` path | ref - ${'/'} | ${'master'} - ${'app/assets'} | ${'master'} + ${'/'} | ${'main'} + ${'app/assets'} | ${'main'} ${'/'} | ${'test'} `('renders table caption for $ref in $path', ({ path, ref }) => { factory({ path }); diff --git a/spec/frontend/repository/components/table/parent_row_spec.js b/spec/frontend/repository/components/table/parent_row_spec.js index cf1ed272634..9daae8c36ef 100644 --- a/spec/frontend/repository/components/table/parent_row_spec.js +++ b/spec/frontend/repository/components/table/parent_row_spec.js @@ -12,7 +12,7 @@ function factory(path, loadingPath) { vm = shallowMount(ParentRow, { propsData: { - commitRef: 'master', + commitRef: 'main', path, loadingPath, }, @@ -32,10 +32,10 @@ describe('Repository parent row component', () => { it.each` path | to - ${'app'} | ${'/-/tree/master/'} - ${'app/assets'} | ${'/-/tree/master/app'} - ${'app/assets#/test'} | ${'/-/tree/master/app/assets%23'} - ${'app/assets#/test/world'} | ${'/-/tree/master/app/assets%23/test'} + ${'app'} | ${'/-/tree/main/'} + ${'app/assets'} | ${'/-/tree/main/app'} + ${'app/assets#/test'} | ${'/-/tree/main/app/assets%23'} + ${'app/assets#/test/world'} | ${'/-/tree/main/app/assets%23/test'} `('renders link in $path to $to', ({ path, to }) => { factory(path); @@ -50,7 +50,7 @@ describe('Repository parent row component', () => { vm.find('td').trigger('click'); expect($router.push).toHaveBeenCalledWith({ - path: '/-/tree/master/app', + path: '/-/tree/main/app', }); }); @@ -62,7 +62,7 @@ describe('Repository parent row component', () => { vm.find('a').trigger('click'); expect($router.push).not.toHaveBeenCalledWith({ - path: '/-/tree/master/app', + path: '/-/tree/main/app', }); }); diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js index 3ebffbedcdb..6ba6f993db1 100644 --- a/spec/frontend/repository/components/table/row_spec.js +++ b/spec/frontend/repository/components/table/row_spec.js @@ -30,7 +30,7 @@ function factory(propsData = {}) { }, }); - vm.setData({ escapedRef: 'master' }); + vm.setData({ escapedRef: 'main' }); } describe('Repository table row component', () => { @@ -115,7 +115,7 @@ describe('Repository table row component', () => { return vm.vm.$nextTick().then(() => { expect(vm.find({ ref: 'link' }).props('to')).toEqual({ - path: `/-/tree/master/${encodeURIComponent(path)}`, + path: `/-/tree/main/${encodeURIComponent(path)}`, }); }); }); @@ -130,7 +130,7 @@ describe('Repository table row component', () => { }); return vm.vm.$nextTick().then(() => { - expect(vm.find('.tree-item-link').props('to')).toEqual({ path: '/-/tree/master/test%23' }); + expect(vm.find('.tree-item-link').props('to')).toEqual({ path: '/-/tree/main/test%23' }); }); }); diff --git a/spec/frontend/repository/components/upload_blob_modal_spec.js b/spec/frontend/repository/components/upload_blob_modal_spec.js index 935ed08f67a..ec85d5666fb 100644 --- a/spec/frontend/repository/components/upload_blob_modal_spec.js +++ b/spec/frontend/repository/components/upload_blob_modal_spec.js @@ -20,8 +20,8 @@ jest.mock('~/lib/utils/url_utility', () => ({ const initialProps = { modalId: 'upload-blob', commitMessage: 'Upload New File', - targetBranch: 'master', - originalBranch: 'master', + targetBranch: 'main', + originalBranch: 'main', canPushCode: true, path: 'new_upload', }; @@ -111,7 +111,7 @@ describe('UploadBlobModal', () => { if (canPushCode) { describe('when changing the branch name', () => { it('displays the MR toggle', async () => { - wrapper.setData({ target: 'Not master' }); + wrapper.setData({ target: 'Not main' }); await wrapper.vm.$nextTick(); diff --git a/spec/frontend/repository/log_tree_spec.js b/spec/frontend/repository/log_tree_spec.js index ddc95feccd6..a842053caad 100644 --- a/spec/frontend/repository/log_tree_spec.js +++ b/spec/frontend/repository/log_tree_spec.js @@ -53,7 +53,7 @@ describe('fetchLogsTree', () => { client = { readQuery: () => ({ projectPath: 'gitlab-org/gitlab-foss', - escapedRef: 'master', + escapedRef: 'main', commits: [], }), writeQuery: jest.fn(), @@ -71,7 +71,7 @@ describe('fetchLogsTree', () => { it('calls axios get', () => fetchLogsTree(client, '', '0', resolver).then(() => { - expect(axios.get).toHaveBeenCalledWith('/gitlab-org/gitlab-foss/-/refs/master/logs_tree/', { + expect(axios.get).toHaveBeenCalledWith('/gitlab-org/gitlab-foss/-/refs/main/logs_tree/', { params: { format: 'json', offset: '0' }, }); })); @@ -114,7 +114,7 @@ describe('fetchLogsTree', () => { query: expect.anything(), data: { projectPath: 'gitlab-org/gitlab-foss', - escapedRef: 'master', + escapedRef: 'main', commits: [ expect.objectContaining({ __typename: 'LogTreeCommit', diff --git a/spec/frontend/repository/router_spec.js b/spec/frontend/repository/router_spec.js index 3354b2315fc..bb82fa706fd 100644 --- a/spec/frontend/repository/router_spec.js +++ b/spec/frontend/repository/router_spec.js @@ -5,14 +5,14 @@ import createRouter from '~/repository/router'; describe('Repository router spec', () => { it.each` - path | branch | component | componentName - ${'/'} | ${'master'} | ${IndexPage} | ${'IndexPage'} - ${'/tree/master'} | ${'master'} | ${TreePage} | ${'TreePage'} - ${'/tree/feat(test)'} | ${'feat(test)'} | ${TreePage} | ${'TreePage'} - ${'/-/tree/master'} | ${'master'} | ${TreePage} | ${'TreePage'} - ${'/-/tree/master/app/assets'} | ${'master'} | ${TreePage} | ${'TreePage'} - ${'/-/tree/123/app/assets'} | ${'master'} | ${null} | ${'null'} - ${'/-/blob/master/file.md'} | ${'master'} | ${BlobPage} | ${'BlobPage'} + path | branch | component | componentName + ${'/'} | ${'main'} | ${IndexPage} | ${'IndexPage'} + ${'/tree/main'} | ${'main'} | ${TreePage} | ${'TreePage'} + ${'/tree/feat(test)'} | ${'feat(test)'} | ${TreePage} | ${'TreePage'} + ${'/-/tree/main'} | ${'main'} | ${TreePage} | ${'TreePage'} + ${'/-/tree/main/app/assets'} | ${'main'} | ${TreePage} | ${'TreePage'} + ${'/-/tree/123/app/assets'} | ${'main'} | ${null} | ${'null'} + ${'/-/blob/main/file.md'} | ${'main'} | ${BlobPage} | ${'BlobPage'} `('sets component as $componentName for path "$path"', ({ path, component, branch }) => { const router = createRouter('', branch); diff --git a/spec/frontend/repository/utils/title_spec.js b/spec/frontend/repository/utils/title_spec.js index a1213c13be8..d5206bdea92 100644 --- a/spec/frontend/repository/utils/title_spec.js +++ b/spec/frontend/repository/utils/title_spec.js @@ -8,9 +8,9 @@ describe('setTitle', () => { ${'app/assets'} | ${'app/assets'} ${'app/assets/javascripts'} | ${'app/assets/javascripts'} `('sets document title as $title for $path', ({ path, title }) => { - setTitle(path, 'master', 'GitLab Org / GitLab'); + setTitle(path, 'main', 'GitLab Org / GitLab'); - expect(document.title).toEqual(`${title} · master · GitLab Org / GitLab · GitLab`); + expect(document.title).toEqual(`${title} · main · GitLab Org / GitLab · GitLab`); }); }); |