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

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2020-05-29 19:23:26 +0300
committerPaul Slaughter <pslaughter@gitlab.com>2020-05-29 19:23:26 +0300
commit7e46b9e4044927f9f8eeadc7020ee3fa2802e17d (patch)
tree500d6440be3802aa48e6a4232522adb38d4bbf2e /spec/frontend/default/components/table_of_contents_spec.js
parentb9158f3993ad2f46824aae74ca021901c9b0bfdb (diff)
Flatten toc items
- Moves dom_parse_toc into shared/toc - Adds flatten_items helper - Updates specs
Diffstat (limited to 'spec/frontend/default/components/table_of_contents_spec.js')
-rw-r--r--spec/frontend/default/components/table_of_contents_spec.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/spec/frontend/default/components/table_of_contents_spec.js b/spec/frontend/default/components/table_of_contents_spec.js
index 6585289d..a4c4863c 100644
--- a/spec/frontend/default/components/table_of_contents_spec.js
+++ b/spec/frontend/default/components/table_of_contents_spec.js
@@ -1,6 +1,7 @@
import { shallowMount, mount } from '@vue/test-utils';
import TableOfContents from '../../../../content/frontend/default/components/table_of_contents.vue';
import * as dom from '../../../../content/frontend/shared/dom';
+import { flattenItems } from '../../../../content/frontend/shared/toc/flatten_items';
import { createExampleToc } from '../../shared/toc_helper';
const TEST_ITEMS = createExampleToc();
@@ -54,15 +55,17 @@ describe('frontend/default/components/table_of_contents', () => {
it('appends help and feedback item', () => {
expect(findMainListItems()).toEqual(
- TEST_ITEMS.concat([
- {
- href: `#${TEST_HELP_AND_FEEDBACK_ID}`,
- id: null,
- items: [],
- text: 'Help and feedback',
- withSeparator: true,
- },
- ]),
+ flattenItems(
+ TEST_ITEMS.concat([
+ {
+ href: `#${TEST_HELP_AND_FEEDBACK_ID}`,
+ id: null,
+ items: [],
+ text: 'Help and feedback',
+ withSeparator: true,
+ },
+ ]),
+ ),
);
});
});
@@ -73,7 +76,7 @@ describe('frontend/default/components/table_of_contents', () => {
});
it('renders toc list', () => {
- expect(findMainListItems()).toEqual(TEST_ITEMS);
+ expect(findMainListItems()).toEqual(flattenItems(TEST_ITEMS));
});
it('is initially uncollapsed', () => {