2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-12 23:22:24 +03:00

feat: add getOptions method (resolves: #215)

This commit is contained in:
pimlie
2019-03-08 12:38:49 +01:00
committed by Alexander Lichter
parent 3db250dfea
commit 31e975d312
3 changed files with 7 additions and 0 deletions
+1
View File
@@ -12,6 +12,7 @@ export default function _$meta(options = {}) {
*/
return function $meta() {
return {
getOptions: () => Object.freeze({ ...options }),
refresh: _refresh.bind(this),
inject,
pause: pause.bind(this),
+1
View File
@@ -13,6 +13,7 @@ export default function _$meta(options = {}) {
*/
return function $meta() {
return {
getOptions: () => Object.freeze({ ...options }),
refresh: _refresh.bind(this),
inject: _inject.bind(this),
pause: pause.bind(this),
+5
View File
@@ -20,9 +20,14 @@ describe('plugin', () => {
expect(instance.$meta().inject).toEqual(expect.any(Function))
expect(instance.$meta().refresh).toEqual(expect.any(Function))
expect(instance.$meta().getOptions).toEqual(expect.any(Function))
expect(instance.$meta().inject()).toBeUndefined()
expect(instance.$meta().refresh()).toBeDefined()
const options = instance.$meta().getOptions()
expect(options).toBeDefined()
expect(options.keyName).toBe(defaultOptions.keyName)
})
test('component has _hasMetaInfo set to true', () => {