| 104 | // Ensure that the Famo.us Transform methods are called with the arguments |
| 105 | // we expect. |
| 106 | function generateTransformTests(attr, method, acceptableValues, expectedOutput) { |
| 107 | |
| 108 | // All values need to be strings that can $parse'd by Angular |
| 109 | var values = { |
| 110 | numbers: expectedOutput + '', |
| 111 | arrays: '[' + expectedOutput + ']', |
| 112 | functions: 'fn', |
| 113 | expressions: 'fn()', |
| 114 | transitionables: 'transitionable' |
| 115 | }; |
| 116 | |
| 117 | for (var valueType in values) { |
| 118 | // If the valueType is one of the acceptableValues to test |
| 119 | if (acceptableValues.indexOf(valueType) !== -1) { |
| 120 | // Generate new spec. Use closure to ensure that the current loop value |
| 121 | // is passed to the it() block |
| 122 | it(valueType, function(type) { |
| 123 | return function() { |
| 124 | var value = values[type]; |
| 125 | var faModifier = compileFaModifier(attr + '="' + value + '"'); |
| 126 | callGetTransform(faModifier); |
| 127 | // Check the arguments that are passed to the Transform module |
| 128 | var expectation = expect(TransformSpy[method]); |
| 129 | // If the expectedOutput is an array, we must convert the array |
| 130 | // into individual arguments to match the expected arguments |
| 131 | if (expectedOutput instanceof Array) { |
| 132 | expectation.toHaveBeenCalledWith.apply(expectation, expectedOutput); |
| 133 | // if the expectedOutput is a number, just check that it matches |
| 134 | } else if (typeof expectedOutput === 'number') { |
| 135 | expectation.toHaveBeenCalledWith(expectedOutput); |
| 136 | } |
| 137 | }; |
| 138 | }(valueType)); |
| 139 | } |
| 140 | } |
| 141 | }; |
| 142 | |
| 143 | describe('fa-rotate should accept', function() { |
| 144 | beforeEach(function() { |