File tree Expand file tree Collapse file tree 4 files changed +32
-32
lines changed
Expand file tree Collapse file tree 4 files changed +32
-32
lines changed Original file line number Diff line number Diff line change @@ -38,34 +38,6 @@ class BootstrapFactory extends ComponentFactory {
3838 this . setDefaultGroupComponent ( 'Group' ) ;
3939 } ;
4040
41- static createComponentFactory ( type ) {
42- switch ( type ) {
43- case 'edit' :
44- return new BootstrapFactory ( {
45- 'string' : 'TextBox' ,
46- 'array' : 'ArrayContainer' ,
47- 'datetime' : 'DateTimePicker' ,
48- 'time' : 'DateTimePicker' ,
49- 'date' : 'DateTimePicker' ,
50- 'int' : 'TextBox' ,
51- 'float' : 'TextBox' ,
52- 'bool' : 'Checkbox' ,
53- 'group' : 'FieldGroup'
54- } ) ;
55- case 'details' :
56- return new BootstrapFactory ( {
57- 'string' : 'Static' ,
58- 'array' : 'ArrayContainer' ,
59- 'datetime' : 'Static' ,
60- 'time' : 'Static' ,
61- 'date' : 'Static' ,
62- 'int' : 'Static' ,
63- 'float' : 'Static' ,
64- 'bool' : 'Static' ,
65- 'group' : 'FieldGroup'
66- } ) ;
67- }
68- }
6941}
7042
7143export default BootstrapFactory ;
Original file line number Diff line number Diff line change 1+ export default {
2+ edit : {
3+ string : 'TextBox' ,
4+ array : 'ArrayContainer' ,
5+ datetime : 'DateTimePicker' ,
6+ time : 'DateTimePicker' ,
7+ date : 'DateTimePicker' ,
8+ int : 'TextBox' ,
9+ float : 'TextBox' ,
10+ bool : 'Checkbox' ,
11+ group : 'FieldGroup'
12+ } ,
13+ details : {
14+ string : 'Static' ,
15+ array : 'ArrayContainer' ,
16+ datetime : 'Static' ,
17+ time : 'Static' ,
18+ date : 'Static' ,
19+ int : 'Static' ,
20+ float : 'Static' ,
21+ bool : 'Static' ,
22+ group : 'FieldGroup'
23+ }
24+ }
Original file line number Diff line number Diff line change 1- export BootstrapFactory from './factory/BootstrapFactory' ;
1+ import BootstrapFactory from './factory/BootstrapFactory' ;
2+ import TypeConfig from './factory/constants/TypeConstants'
3+
4+ export const EditComponentFactory = new BootstrapFactory ( TypeConfig . edit )
5+ export const DetailsComponentFactory = new BootstrapFactory ( TypeConfig . details ) ;
Original file line number Diff line number Diff line change 1- import { BootstrapFactory } from '../src/index' ;
1+ import { EditComponentFactory , DetailsComponentFactory } from '../src/index' ;
22import { expect } from 'chai' ;
33
44
@@ -17,7 +17,7 @@ describe("Factory creation", function() {
1717 'group' : 'FieldGroup'
1818 } ;
1919
20- let factory = BootstrapFactory . createComponentFactory ( "edit" ) ;
20+ let factory = EditComponentFactory ;
2121
2222 expect ( factory . defaultFieldComponents ) . to . be . deep . equal ( correctConfig ) ;
2323 done ( )
@@ -36,7 +36,7 @@ describe("Factory creation", function() {
3636 'group' : 'FieldGroup'
3737 } ;
3838
39- let factory = BootstrapFactory . createComponentFactory ( "details" ) ;
39+ let factory = DetailsComponentFactory ;
4040
4141 expect ( factory . defaultFieldComponents ) . to . be . deep . equal ( correctConfig ) ;
4242 done ( )
You can’t perform that action at this time.
0 commit comments