diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/frontend/editor/components/helpers.js | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/frontend/editor/components/helpers.js')
-rw-r--r-- | spec/frontend/editor/components/helpers.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/frontend/editor/components/helpers.js b/spec/frontend/editor/components/helpers.js index 3e6cd2a236d..12f90390c18 100644 --- a/spec/frontend/editor/components/helpers.js +++ b/spec/frontend/editor/components/helpers.js @@ -1,12 +1,28 @@ import { EDITOR_TOOLBAR_RIGHT_GROUP } from '~/editor/constants'; +import { apolloProvider } from '~/editor/components/source_editor_toolbar_graphql'; +import getToolbarItemsQuery from '~/editor/graphql/get_items.query.graphql'; export const buildButton = (id = 'foo-bar-btn', options = {}) => { return { __typename: 'Item', id, label: options.label || 'Foo Bar Button', - icon: options.icon || 'foo-bar', + icon: options.icon || 'check', selected: options.selected || false, group: options.group || EDITOR_TOOLBAR_RIGHT_GROUP, + onClick: options.onClick || (() => {}), + category: options.category || 'primary', + selectedLabel: options.selectedLabel || 'smth', }; }; + +export const warmUpCacheWithItems = (items = []) => { + apolloProvider.defaultClient.cache.writeQuery({ + query: getToolbarItemsQuery, + data: { + items: { + nodes: items, + }, + }, + }); +}; |