summaryrefslogtreecommitdiff
path: root/spec/frontend/vuex_shared/bindings_spec.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 09:55:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-20 09:55:51 +0000
commite8d2c2579383897a1dd7f9debd359abe8ae8373d (patch)
treec42be41678c2586d49a75cabce89322082698334 /spec/frontend/vuex_shared/bindings_spec.js
parentfc845b37ec3a90aaa719975f607740c22ba6a113 (diff)
downloadgitlab-ce-14.1.0-rc42.tar.gz
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/frontend/vuex_shared/bindings_spec.js')
-rw-r--r--spec/frontend/vuex_shared/bindings_spec.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/frontend/vuex_shared/bindings_spec.js b/spec/frontend/vuex_shared/bindings_spec.js
index 0f91a09018f..4e210143c8c 100644
--- a/spec/frontend/vuex_shared/bindings_spec.js
+++ b/spec/frontend/vuex_shared/bindings_spec.js
@@ -3,7 +3,7 @@ import { mapComputed } from '~/vuex_shared/bindings';
describe('Binding utils', () => {
describe('mapComputed', () => {
- const defaultArgs = [['baz'], 'bar', 'foo'];
+ const defaultArgs = [['baz'], 'bar', 'foo', 'qux'];
const createDummy = (mapComputedArgs = defaultArgs) => ({
computed: {
@@ -29,12 +29,18 @@ describe('Binding utils', () => {
},
};
- it('returns an object with keys equal to the first fn parameter ', () => {
+ it('returns an object with keys equal to the first fn parameter', () => {
const keyList = ['foo1', 'foo2'];
const result = mapComputed(keyList, 'foo', 'bar');
expect(Object.keys(result)).toEqual(keyList);
});
+ it('returns an object with keys equal to the first fn parameter when the root is a function', () => {
+ const keyList = ['foo1', 'foo2'];
+ const result = mapComputed(keyList, 'foo', (state) => state.bar);
+ expect(Object.keys(result)).toEqual(keyList);
+ });
+
it('returned object has set and get function', () => {
const result = mapComputed(['baz'], 'foo', 'bar');
expect(result.baz.set).toBeDefined();