1 | * [transform](transform)
|
2 | * [shouldToBoolean()](shouldtoboolean())
|
3 | * [stringToVariableName()](stringtovariablename())
|
4 | * [elementTypeToVariableName()](elementtypetovariablename())
|
5 | # transform
|
6 | transform should exist on the World
|
7 |
|
8 | ```
|
9 | var world;
|
10 | world = new World(function() {});
|
11 | return expect(world.transform).to.be.an.instanceOf(Transform);
|
12 | ```
|
13 |
|
14 |
|
15 | ## shouldToBoolean()
|
16 | shouldToBoolean() should convert the string "should" to true
|
17 |
|
18 | ```
|
19 | expect(transform.shouldToBoolean('should')).to.equal(true);
|
20 | ```
|
21 |
|
22 |
|
23 | shouldToBoolean() should convert the string "should not" to false
|
24 |
|
25 | ```
|
26 | expect(transform.shouldToBoolean('should not')).to.equal(false);
|
27 | ```
|
28 |
|
29 |
|
30 | ## stringToVariableName()
|
31 | stringToVariableName() should make the first letter of a string lower case
|
32 |
|
33 | ```
|
34 | expect(transform.stringToVariableName('Test')).to.equal('test');
|
35 | ```
|
36 |
|
37 |
|
38 | stringToVariableName() should not affect letters after the first letter
|
39 |
|
40 | ```
|
41 | expect(transform.stringToVariableName('TEST')).to.equal('tEST');
|
42 | ```
|
43 |
|
44 |
|
45 | stringToVariableName() should remove spaces
|
46 |
|
47 | ```
|
48 | expect(transform.stringToVariableName('Test String')).to.equal('testString');
|
49 | ```
|
50 |
|
51 |
|
52 | stringToVariableName() should replace "&" with "And"
|
53 |
|
54 | ```
|
55 | expect(transform.stringToVariableName('Tom & Jerry')).to.equal('tomAndJerry');
|
56 | ```
|
57 |
|
58 |
|
59 | ## elementTypeToVariableName()
|
60 | elementTypeToVariableName() should convert the string "drop down list" to "Select"
|
61 |
|
62 | ```
|
63 | expect(transform.elementTypeToVariableName('drop down list')).to.equal('Select');
|
64 | ```
|
65 |
|
66 |
|
67 | elementTypeToVariableName() should capitalize the first letter of other strings and pass them through
|
68 |
|
69 | ```
|
70 | expect(transform.elementTypeToVariableName('button')).to.equal('Button');
|
71 | ```
|
72 |
|
73 |
|
74 | elementTypeToVariableName() should trim white space
|
75 |
|
76 | ```
|
77 | expect(transform.elementTypeToVariableName(' button ')).to.equal('Button');
|
78 | ```
|