Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-17 18:09:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-17 18:09:01 +0300
commitb304a72312465ed4c0a568ee6a6ea5e97f705c9b (patch)
treea2f25dbea26c81e88b169c55a6275e3969323e82 /spec/frontend/diffs
parentb84eeb256c4a780d902faee1f99ca9a711b3214a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/diffs')
-rw-r--r--spec/frontend/diffs/components/diff_file_row_spec.js37
1 files changed, 35 insertions, 2 deletions
diff --git a/spec/frontend/diffs/components/diff_file_row_spec.js b/spec/frontend/diffs/components/diff_file_row_spec.js
index 3e95d1d55bd..bd5b3afdc05 100644
--- a/spec/frontend/diffs/components/diff_file_row_spec.js
+++ b/spec/frontend/diffs/components/diff_file_row_spec.js
@@ -1,6 +1,7 @@
import { shallowMount } from '@vue/test-utils';
import DiffFileRow from '~/diffs/components/diff_file_row.vue';
import FileRow from '~/vue_shared/components/file_row.vue';
+import FileRowStats from '~/diffs/components/file_row_stats.vue';
describe('Diff File Row component', () => {
let wrapper;
@@ -16,10 +17,42 @@ describe('Diff File Row component', () => {
});
it('renders file row component', () => {
- createComponent({
+ const sharedProps = {
level: 4,
file: {},
+ };
+
+ const diffFileRowProps = {
+ hideFileStats: false,
+ };
+
+ createComponent({
+ ...sharedProps,
+ ...diffFileRowProps,
+ });
+
+ expect(wrapper.find(FileRow).props()).toEqual(
+ expect.objectContaining({
+ ...sharedProps,
+ }),
+ );
+ });
+
+ describe('FileRowStats components', () => {
+ it.each`
+ type | hideFileStats | value | desc
+ ${'blob'} | ${false} | ${true} | ${'is shown if file type is blob'}
+ ${'tree'} | ${false} | ${false} | ${'is hidden if file is not blob'}
+ ${'blob'} | ${true} | ${false} | ${'is hidden if hideFileStats is true'}
+ `('$desc', ({ type, value, hideFileStats }) => {
+ createComponent({
+ level: 4,
+ file: {
+ type,
+ },
+ hideFileStats,
+ });
+ expect(wrapper.find(FileRowStats).exists()).toEqual(value);
});
- expect(wrapper.find(FileRow).exists()).toEqual(true);
});
});