From 02f64484239727344421ca2a3a8166ccecc46798 Mon Sep 17 00:00:00 2001 From: Ryan Thaut Date: Fri, 6 Jul 2018 19:54:17 -0600 Subject: [PATCH 1/2] fix tests for `has-error` and has-success` classes --- test/directives/schema-form-test.js | 70 ++++++++++++++--------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/test/directives/schema-form-test.js b/test/directives/schema-form-test.js index 70aef44d4..61f26df5c 100644 --- a/test/directives/schema-form-test.js +++ b/test/directives/schema-form-test.js @@ -817,25 +817,25 @@ describe('directive',function(){ }); }); - it('should not clear the model when using multiple checkboxes targeting the same model array', function () { + it('should not clear the model when using multiple checkboxes targeting the same model array', function () { - inject(function ($compile, $rootScope) { + inject(function ($compile, $rootScope) { var scope = $rootScope.$new(); - scope.person = { - "names": ["foo"] + scope.person = { + "names": ["foo"] }; - scope.schema = { + scope.schema = { "type": "object", - "properties": { - "names": { + "properties": { + "names": { "type": "array", - "items": { + "items": { "type": "string", - "enum": ["foo", "bar"] - } - } - } + "enum": ["foo", "bar"] + } + } + } }; scope.form = [ @@ -848,24 +848,24 @@ describe('directive',function(){ var tmpl = angular.element('
'); $compile(tmpl)(scope); - $rootScope.$apply(); - + $rootScope.$apply(); + var foo = tmpl.children().eq(0).find('input[type=checkbox]').eq(0); - var bar = tmpl.children().eq(3).find('input[type=checkbox]').eq(1); - - foo.prop('checked').should.be.true; - bar.prop('checked').should.be.false; - scope.person.names.length.should.be.equal(1); - scope.person.names.join(',').should.be.equal('foo'); - - bar.click() - scope.person.names.length.should.be.equal(2); - scope.person.names.join(',').should.be.equal('foo,bar'); - + var bar = tmpl.children().eq(3).find('input[type=checkbox]').eq(1); + + foo.prop('checked').should.be.true; + bar.prop('checked').should.be.false; + scope.person.names.length.should.be.equal(1); + scope.person.names.join(',').should.be.equal('foo'); + + bar.click() + scope.person.names.length.should.be.equal(2); + scope.person.names.join(',').should.be.equal('foo,bar'); + foo.click(); scope.person.names.length.should.be.equal(1); - scope.person.names.join(',').should.be.equal('bar'); - }); + scope.person.names.join(',').should.be.equal('bar'); + }); }); it('should use radio buttons when they are wanted',function(){ @@ -2144,10 +2144,10 @@ describe('directive',function(){ ngModelCtrl.$valid = true; ngModelCtrl.$pristine = false; $rootScope.$apply(); - tmpl.children().eq(0).children().eq(0).hasClass('has-success').should.be.true; + tmpl.children().eq(0).hasClass('has-success').should.be.true; scope.form[0].disableSuccessState = true; $rootScope.$apply(); - tmpl.children().eq(0).children().eq(0).hasClass('has-success').should.be.false; + tmpl.children().eq(0).hasClass('has-success').should.be.false; }); }); @@ -2194,10 +2194,10 @@ describe('directive',function(){ ngModelCtrl.$invalid = true; ngModelCtrl.$pristine = false; $rootScope.$apply(); - tmpl.children().eq(0).children().eq(0).hasClass('has-error').should.be.true; + tmpl.children().eq(0).hasClass('has-error').should.be.true; scope.form[0].disableErrorState = true; $rootScope.$apply(); - tmpl.children().eq(0).children().eq(0).hasClass('has-error').should.be.false; + tmpl.children().eq(0).hasClass('has-error').should.be.false; }); }); @@ -2242,10 +2242,10 @@ describe('directive',function(){ ngModelCtrl.$valid = true; ngModelCtrl.$pristine = false; $rootScope.$apply(); - tmpl.children().eq(0).children().eq(0).hasClass('has-success').should.be.true; + tmpl.children().eq(0).hasClass('has-success').should.be.true; scope.form[0].disableSuccessState = true; $rootScope.$apply(); - tmpl.children().eq(0).children().eq(0).hasClass('has-success').should.be.false; + tmpl.children().eq(0).hasClass('has-success').should.be.false; }); }); @@ -2292,10 +2292,10 @@ describe('directive',function(){ ngModelCtrl.$invalid = true; ngModelCtrl.$pristine = false; $rootScope.$apply(); - tmpl.children().eq(0).children().eq(0).hasClass('has-error').should.be.true; + tmpl.children().eq(0).hasClass('has-error').should.be.true; scope.form[0].disableErrorState = true; $rootScope.$apply(); - tmpl.children().eq(0).children().eq(0).hasClass('has-error').should.be.false; + tmpl.children().eq(0).hasClass('has-error').should.be.false; }); }); From b59ffcaf18fdc66b47e5ed138d4978a0648f9e70 Mon Sep 17 00:00:00 2001 From: Ryan Thaut Date: Fri, 6 Jul 2018 19:56:31 -0600 Subject: [PATCH 2/2] remove log statement --- test/directives/sf-messages-test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/directives/sf-messages-test.js b/test/directives/sf-messages-test.js index 8a872bc3c..1b4c34aa8 100644 --- a/test/directives/sf-messages-test.js +++ b/test/directives/sf-messages-test.js @@ -36,7 +36,6 @@ describe('directive',function() { $compile(tmpl)(scope); $rootScope.$apply(); - console.log(tmpl.children().find('div.help-block')[0]); tmpl.children().find('div.help-block').text().should.equal('foobar'); setTimeout(function() {