-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compiler): component can be class (#454)
* feat(compiler): component can be class * feat(compiler): component can be class * docs(readme): component as class * fix(compiler): typeof to determine if name
- Loading branch information
Showing
3 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
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
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
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,25 @@ | ||
import { Compiler } from './compiler'; | ||
import components from '../components'; | ||
import TextField from '../fields/text-field'; | ||
|
||
let compiler = null; | ||
|
||
class NameField extends TextField { | ||
className = 'app.NameField'; | ||
|
||
create(props) { | ||
super.create(props); | ||
this.set({ minLength: 5 }); | ||
} | ||
} | ||
|
||
beforeEach(() => { | ||
compiler = new Compiler({ components: { ...components } }); | ||
}); | ||
|
||
it('should support class as component', () => { | ||
const name = compiler.newComponent({ | ||
component: NameField, | ||
}); | ||
expect(name.get('minLength')).toEqual(5); | ||
}); |