| 341 | // Generate tests that ensure that the Modifier constructor is called with |
| 342 | // the arguments we expect. |
| 343 | function generateModifierTests(attr, method, acceptableValues, expectedOutput) { |
| 344 | |
| 345 | // All values need to be strings that can $parse'd by Angular |
| 346 | var values = { |
| 347 | numbers: expectedOutput + '', |
| 348 | arrays: '[' + expectedOutput + ']', |
| 349 | functions: 'fn', |
| 350 | expressions: 'fn()', |
| 351 | transitionables: 'transitionable' |
| 352 | }; |
| 353 | |
| 354 | for (var valueType in values) { |
| 355 | // If the valueType is one of the acceptableValues to test |
| 356 | if (acceptableValues.indexOf(valueType) !== -1) { |
| 357 | // Generate specs. Use closure to ensure that the current loop value |
| 358 | // is passed to the it() block |
| 359 | it(valueType, function(type) { |
| 360 | return function() { |
| 361 | var value = values[type]; |
| 362 | var faModifier = compileFaModifier(attr + '="' + value + '"'); |
| 363 | var args = ModifierSpy.calls.mostRecent().args[0]; |
| 364 | expect(args[method]()).toEqual(expectedOutput); |
| 365 | }; |
| 366 | }(valueType)); |
| 367 | } |
| 368 | } |
| 369 | }; |
| 370 | |
| 371 | |
| 372 | describe('fa-size should accept', function() { |