Commit ed47410b authored by Fernando's avatar Fernando

Maintainer feedback code changes

* Use gl-sprintf
* Make test assertion more explicit
parent a11d3701
<script>
import { GlButton } from '@gitlab/ui';
import { GlButton, GlSprintf } from '@gitlab/ui';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import { s__ } from '~/locale';
export default {
components: {
GlButton,
GlSprintf,
},
props: {
totalSize: {
......@@ -14,7 +15,7 @@ export default {
},
},
i18n: {
totalSize: s__('CorpusManagement|Total Size:'),
totalSize: s__('CorpusManagement|Total Size: %{totalSize}'),
newCorpus: s__('CorpusManagement|New corpus'),
},
computed: {
......@@ -35,7 +36,12 @@ export default {
>
<div class="gl-ml-5">
{{ this.$options.i18n.totalSize }}
<span class="gl-font-weight-bold">{{ formattedFileSize }}</span>
<gl-sprintf :message="$options.i18n.totalSize">
<template #totalSize>
<span class="gl-font-weight-bold">{{ formattedFileSize }}</span>
</template>
</gl-sprintf>
</div>
<gl-button class="gl-mr-5" category="primary" variant="confirm" @click="newCorpus">
......
......@@ -8,13 +8,12 @@ exports[`Corpus Upload component renders header 1`] = `
class="gl-ml-5"
>
Total Size:
Total Size: %{totalSize}
<span
class="gl-font-weight-bold"
>
381.47 MiB
</span>
<gl-sprintf-stub
message="Total Size: %{totalSize}"
/>
</div>
<gl-button-stub
......
......@@ -30,7 +30,7 @@ describe('Corpus Upload', () => {
createComponent({ stubs: { GlButton } });
await wrapper.findComponent(GlButton).trigger('click');
expect(wrapper.emitted().newcorpus).toBeTruthy();
expect(wrapper.emitted().newcorpus).toEqual([[]]);
});
});
});
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