This repository has been archived by the owner on Jan 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4a6ee7
commit 0955551
Showing
4 changed files
with
35 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { InjectModel } from './decorator' | ||
import Component from 'vue-class-component' | ||
import Vue from 'vue' | ||
|
||
describe('InjectModel', () => { | ||
@Component | ||
class Test extends Vue { | ||
@InjectModel test: any | ||
} | ||
it('maps correctly', () => { | ||
const component = new Test() | ||
expect(component.$options.injectModels).toStrictEqual(['test']) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createDecorator } from 'vue-class-component' | ||
|
||
// tslint:disable-next-line | ||
export const InjectModel = createDecorator((options: any, key) => { | ||
if (!options.injectModels) { | ||
options.injectModels = [] | ||
} | ||
options.injectModels.push(key) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters