summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2019-05-21 09:27:09 +0000
committerFilipa Lacerda <filipa@gitlab.com>2019-05-21 09:27:09 +0000
commit5ae293e33c4d6c8187543778717474a7aaccee1c (patch)
tree7d507f68e8b9857a4db1aa7d5cac82274a300e29 /spec
parent383d61af5c2a5a920213957365f6a2a791f79103 (diff)
parenta3014debbd9435c90a86be398d33b1cd3453f10c (diff)
downloadgitlab-ce-5ae293e33c4d6c8187543778717474a7aaccee1c.tar.gz
Merge branch 'repo-list-table-component' into 'master'
Added table component for file listing See merge request gitlab-org/gitlab-ce!28334
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/repository/components/table/index_spec.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/frontend/repository/components/table/index_spec.js b/spec/frontend/repository/components/table/index_spec.js
new file mode 100644
index 00000000000..6f52cffe077
--- /dev/null
+++ b/spec/frontend/repository/components/table/index_spec.js
@@ -0,0 +1,47 @@
+import { shallowMount } from '@vue/test-utils';
+import { GlLoadingIcon } from '@gitlab/ui';
+import Table from '~/repository/components/table/index.vue';
+
+let vm;
+
+function factory(path, loading = false) {
+ vm = shallowMount(Table, {
+ propsData: {
+ path,
+ },
+ mocks: {
+ $apollo: {
+ queries: {
+ files: { loading },
+ },
+ },
+ },
+ });
+}
+
+describe('Repository table component', () => {
+ afterEach(() => {
+ vm.destroy();
+ });
+
+ it.each`
+ path | ref
+ ${'/'} | ${'master'}
+ ${'app/assets'} | ${'master'}
+ ${'/'} | ${'test'}
+ `('renders table caption for $ref in $path', ({ path, ref }) => {
+ factory(path);
+
+ vm.setData({ ref });
+
+ expect(vm.find('caption').text()).toEqual(
+ `Files, directories, and submodules in the path ${path} for commit reference ${ref}`,
+ );
+ });
+
+ it('renders loading icon', () => {
+ factory('/', true);
+
+ expect(vm.find(GlLoadingIcon).exists()).toBe(true);
+ });
+});