Commit 3ddc5181 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch '337415-add-spacing-to-corpus-management' into 'master'

Update corpus management file size formatting

See merge request gitlab-org/gitlab!84233
parents 18521850 dffa5d63
...@@ -18,7 +18,9 @@ export default { ...@@ -18,7 +18,9 @@ export default {
}, },
computed: { computed: {
fileSize() { fileSize() {
return decimalBytes(this.corpus.package.packageFiles.nodes[0].size); return decimalBytes(this.corpus.package.packageFiles.nodes[0].size, 0, {
unitSeparator: ' ',
});
}, },
jobUrl() { jobUrl() {
return this.corpus.package.pipelines.nodes[0]?.path; return this.corpus.package.pipelines.nodes[0]?.path;
......
...@@ -19,7 +19,7 @@ export default { ...@@ -19,7 +19,7 @@ export default {
}, },
computed: { computed: {
formattedFileSize() { formattedFileSize() {
return decimalBytes(this.totalSize); return decimalBytes(this.totalSize, 0, { unitSeparator: ' ' });
}, },
}, },
}; };
......
...@@ -12,7 +12,7 @@ exports[`Corpus Upload component renders total size 1`] = ` ...@@ -12,7 +12,7 @@ exports[`Corpus Upload component renders total size 1`] = `
class="gl-font-weight-bold" class="gl-font-weight-bold"
data-testid="total-size" data-testid="total-size"
> >
400MB 400 MB
</span> </span>
</div> </div>
......
...@@ -12,7 +12,7 @@ exports[`Name component renders name with correct file size 1`] = ` ...@@ -12,7 +12,7 @@ exports[`Name component renders name with correct file size 1`] = `
class="gl-text-gray-500" class="gl-text-gray-500"
data-testid="file-size" data-testid="file-size"
> >
(400MB) (400 MB)
</span> </span>
</div> </div>
`; `;
...@@ -29,7 +29,7 @@ exports[`Name component renders the latest job 1`] = ` ...@@ -29,7 +29,7 @@ exports[`Name component renders the latest job 1`] = `
class="gl-text-gray-500" class="gl-text-gray-500"
data-testid="file-size" data-testid="file-size"
> >
(400MB) (400 MB)
</span> </span>
</div> </div>
`; `;
...@@ -46,7 +46,7 @@ exports[`Name component without job path renders a - string instead of a link 1` ...@@ -46,7 +46,7 @@ exports[`Name component without job path renders a - string instead of a link 1`
class="gl-text-gray-500" class="gl-text-gray-500"
data-testid="file-size" data-testid="file-size"
> >
(321MB) (321 MB)
</span> </span>
</div> </div>
`; `;
...@@ -28,14 +28,14 @@ describe('Name', () => { ...@@ -28,14 +28,14 @@ describe('Name', () => {
describe('component', () => { describe('component', () => {
it('renders name with correct file size', () => { it('renders name with correct file size', () => {
createComponent(); createComponent();
expect(findFileSize().text()).toBe('(400MB)'); expect(findFileSize().text()).toBe('(400 MB)');
expect(findName().element).toMatchSnapshot(); expect(findName().element).toMatchSnapshot();
}); });
it('renders the latest job', () => { it('renders the latest job', () => {
createComponent(); createComponent();
expect(wrapper.findComponent(GlLink).exists()).toBe(true); expect(wrapper.findComponent(GlLink).exists()).toBe(true);
expect(findFileSize().text()).toBe('(400MB)'); expect(findFileSize().text()).toBe('(400 MB)');
expect(findName().element).toMatchSnapshot(); expect(findName().element).toMatchSnapshot();
}); });
...@@ -43,7 +43,7 @@ describe('Name', () => { ...@@ -43,7 +43,7 @@ describe('Name', () => {
it('renders a - string instead of a link', () => { it('renders a - string instead of a link', () => {
createComponent({ propsData: { corpus: corpuses[2] } }); createComponent({ propsData: { corpus: corpuses[2] } });
expect(wrapper.findComponent(GlLink).exists()).toBe(false); expect(wrapper.findComponent(GlLink).exists()).toBe(false);
expect(findFileSize().text()).toBe('(321MB)'); expect(findFileSize().text()).toBe('(321 MB)');
expect(findName().element).toMatchSnapshot(); expect(findName().element).toMatchSnapshot();
}); });
}); });
......
...@@ -28,7 +28,9 @@ describe('Corpus Upload', () => { ...@@ -28,7 +28,9 @@ describe('Corpus Upload', () => {
createComponent(); createComponent();
expect(findGlSprintf().exists()).toBe(true); expect(findGlSprintf().exists()).toBe(true);
expect(findTotalSizeText().text()).toContain(decimalBytes(defaultProps.totalSize)); expect(findTotalSizeText().text()).toContain(
decimalBytes(defaultProps.totalSize, 0, { unitSeparator: ' ' }),
);
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment