Skip to content

Commit d98f1b4

Browse files
author
mokimo
committed
fix(api): add getGlobalConfig helper
1 parent a037ff8 commit d98f1b4

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

spec/config.spec.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ describe('Editable configuration', () => {
3939
Editable.globalConfig(originalConfig)
4040
})
4141

42+
it('retreives the default config', () => {
43+
expect(originalConfig).toEqual(Editable.getGlobalConfig())
44+
})
45+
46+
it('retrieves the default config after changes to the globalConfig', () => {
47+
Editable.globalConfig({
48+
editableClass: 'editable-instance'
49+
})
50+
51+
expect(originalConfig).not.toEqual(Editable.getGlobalConfig())
52+
})
53+
4254
it('has a default value for "editableClass"', () => {
4355
expect(config.editableClass).toEqual('js-editable')
4456
})

src/core.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ const Editable = module.exports = class Editable {
5858
}
5959
}
6060

61+
/**
62+
* @returns the default Editable configs from config.js
63+
*/
64+
static getGlobalConfig () {
65+
return config
66+
}
67+
6168
/**
6269
* Set configuration options that affect all editable
6370
* instances.

0 commit comments

Comments
 (0)