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:
committed by
Alexander Lichter
parent
3db250dfea
commit
31e975d312
@@ -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),
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user