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 {
},
computed: {
fileSize() {
return decimalBytes(this.corpus.package.packageFiles.nodes[0].size);
return decimalBytes(this.corpus.package.packageFiles.nodes[0].size, 0, {
unitSeparator: ' ',
});
},
jobUrl() {
return this.corpus.package.pipelines.nodes[0]?.path;
......
......@@ -19,7 +19,7 @@ export default {
},
computed: {
formattedFileSize() {
return decimalBytes(this.totalSize);
return decimalBytes(this.totalSize, 0, { unitSeparator: ' ' });
},
},
};
......
......@@ -12,7 +12,7 @@ exports[`Corpus Upload component renders total size 1`] = `
class="gl-font-weight-bold"
data-testid="total-size"
>
400MB
400 MB
</span>
</div>
......
......@@ -12,7 +12,7 @@ exports[`Name component renders name with correct file size 1`] = `
class="gl-text-gray-500"
data-testid="file-size"
>
(400MB)
(400 MB)
</span>
</div>
`;
......@@ -29,7 +29,7 @@ exports[`Name component renders the latest job 1`] = `
class="gl-text-gray-500"
data-testid="file-size"
>
(400MB)
(400 MB)
</span>
</div>
`;
......@@ -46,7 +46,7 @@ exports[`Name component without job path renders a - string instead of a link 1`
class="gl-text-gray-500"
data-testid="file-size"
>
(321MB)
(321 MB)
</span>
</div>
`;
......@@ -28,14 +28,14 @@ describe('Name', () => {
describe('component', () => {
it('renders name with correct file size', () => {
createComponent();
expect(findFileSize().text()).toBe('(400MB)');
expect(findFileSize().text()).toBe('(400 MB)');
expect(findName().element).toMatchSnapshot();
});
it('renders the latest job', () => {
createComponent();
expect(wrapper.findComponent(GlLink).exists()).toBe(true);
expect(findFileSize().text()).toBe('(400MB)');
expect(findFileSize().text()).toBe('(400 MB)');
expect(findName().element).toMatchSnapshot();
});
......@@ -43,7 +43,7 @@ describe('Name', () => {
it('renders a - string instead of a link', () => {
createComponent({ propsData: { corpus: corpuses[2] } });
expect(wrapper.findComponent(GlLink).exists()).toBe(false);
expect(findFileSize().text()).toBe('(321MB)');
expect(findFileSize().text()).toBe('(321 MB)');
expect(findName().element).toMatchSnapshot();
});
});
......
......@@ -28,7 +28,9 @@ describe('Corpus Upload', () => {
createComponent();
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();
});
});
......
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