Skip to content

Commit

Permalink
Fix for formly-js#358
Browse files Browse the repository at this point in the history
  • Loading branch information
ccasad committed Jun 25, 2015
1 parent 3d7aa51 commit 2f407ba
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/run/formlyNgModelAttrsManipulator.test.js
Expand Up @@ -28,23 +28,22 @@ describe('formlyNgModelAttrsManipulator', () => {
expect(result).to.equal(template);
});

it.skip(`should allow you to specify a selector for specific elements to skip`, () => {
const className = 'ignored-thing' + _.random(0, 10);
it(`should allow you to specify a selector for specific elements to skip`, () => {
field.templateOptions.required = true;
field.data.skipNgModelAttrsManipulator = `.${className}`;
field.data.skipNgModelAttrsManipulator = '.ignored-thing';
manipulate(`
<div>
<input class="first-thing" ng-model="model[options.key]" />
<input class="${className}" ng-model="model[options.key]" />
<input class="ignored-thing" ng-model="model[options.key]" />
</div>
`);
const firstInput = angular.element(resultNode.querySelector('.first-thing'));
const secondInput = angular.element(resultNode.querySelector(`.${className}`));
const secondInput = angular.element(resultNode.querySelector('.ignored-thing'));
expect(firstInput.attr('required')).to.exist;
expect(secondInput.attr('required')).to.not.exist;
});

it.skip(`should allow you to place the attribute formly-skip-ng-model-attrs-manipulator on an ng-model to have it skip`, () => {
it(`should allow you to place the attribute formly-skip-ng-model-attrs-manipulator on an ng-model to have it skip`, () => {
field.templateOptions.required = true;
manipulate(`
<div>
Expand All @@ -58,19 +57,18 @@ describe('formlyNgModelAttrsManipulator', () => {
expect(secondInput.attr('required')).to.not.exist;
});

it.skip(`should allow you to skip using both the special attribute and the custom selector`, () => {
const className = 'ignored-thing' + _.random(0, 10);
it(`should allow you to skip using both the special attribute and the custom selector`, () => {
field.templateOptions.required = true;
field.data.skipNgModelAttrsManipulator = `.${className}`;
field.data.skipNgModelAttrsManipulator = '.ignored-thing';
manipulate(`
<div>
<input class="first-thing" ng-model="model[options.key]" />
<input class="${className}" ng-model="model[options.key]" />
<input class="ignored-thing" ng-model="model[options.key]" />
<input ng-model="model[options.key]" formly-skip-ng-model-attrs-manipulator />
</div>
`);
const firstInput = angular.element(resultNode.querySelector('.first-thing'));
const secondInput = angular.element(resultNode.querySelector(`.${className}`));
const secondInput = angular.element(resultNode.querySelector('.ignored-thing'));
const thirdInput = angular.element(resultNode.querySelector('[formly-skip-ng-model-attrs-manipulator]'));
expect(firstInput.attr('required')).to.exist;
expect(secondInput.attr('required')).to.not.exist;
Expand Down

0 comments on commit 2f407ba

Please sign in to comment.