Skip to content

Commit ba3e5f8

Browse files
authored
Merge pull request #979 from rthaut/support/0.x
Fix Karma Unit Tests (support/0.x)
2 parents e4201b7 + b59ffca commit ba3e5f8

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

test/directives/schema-form-test.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -817,25 +817,25 @@ describe('directive',function(){
817817
});
818818
});
819819

820-
it('should not clear the model when using multiple checkboxes targeting the same model array', function () {
820+
it('should not clear the model when using multiple checkboxes targeting the same model array', function () {
821821

822-
inject(function ($compile, $rootScope) {
822+
inject(function ($compile, $rootScope) {
823823
var scope = $rootScope.$new();
824-
scope.person = {
825-
"names": ["foo"]
824+
scope.person = {
825+
"names": ["foo"]
826826
};
827827

828-
scope.schema = {
828+
scope.schema = {
829829
"type": "object",
830-
"properties": {
831-
"names": {
830+
"properties": {
831+
"names": {
832832
"type": "array",
833-
"items": {
833+
"items": {
834834
"type": "string",
835-
"enum": ["foo", "bar"]
836-
}
837-
}
838-
}
835+
"enum": ["foo", "bar"]
836+
}
837+
}
838+
}
839839
};
840840

841841
scope.form = [
@@ -848,24 +848,24 @@ describe('directive',function(){
848848
var tmpl = angular.element('<form sf-schema="schema" sf-form="form" sf-model="person"></form>');
849849

850850
$compile(tmpl)(scope);
851-
$rootScope.$apply();
852-
851+
$rootScope.$apply();
852+
853853
var foo = tmpl.children().eq(0).find('input[type=checkbox]').eq(0);
854-
var bar = tmpl.children().eq(3).find('input[type=checkbox]').eq(1);
855-
856-
foo.prop('checked').should.be.true;
857-
bar.prop('checked').should.be.false;
858-
scope.person.names.length.should.be.equal(1);
859-
scope.person.names.join(',').should.be.equal('foo');
860-
861-
bar.click()
862-
scope.person.names.length.should.be.equal(2);
863-
scope.person.names.join(',').should.be.equal('foo,bar');
864-
854+
var bar = tmpl.children().eq(3).find('input[type=checkbox]').eq(1);
855+
856+
foo.prop('checked').should.be.true;
857+
bar.prop('checked').should.be.false;
858+
scope.person.names.length.should.be.equal(1);
859+
scope.person.names.join(',').should.be.equal('foo');
860+
861+
bar.click()
862+
scope.person.names.length.should.be.equal(2);
863+
scope.person.names.join(',').should.be.equal('foo,bar');
864+
865865
foo.click();
866866
scope.person.names.length.should.be.equal(1);
867-
scope.person.names.join(',').should.be.equal('bar');
868-
});
867+
scope.person.names.join(',').should.be.equal('bar');
868+
});
869869
});
870870

871871
it('should use radio buttons when they are wanted',function(){
@@ -2144,10 +2144,10 @@ describe('directive',function(){
21442144
ngModelCtrl.$valid = true;
21452145
ngModelCtrl.$pristine = false;
21462146
$rootScope.$apply();
2147-
tmpl.children().eq(0).children().eq(0).hasClass('has-success').should.be.true;
2147+
tmpl.children().eq(0).hasClass('has-success').should.be.true;
21482148
scope.form[0].disableSuccessState = true;
21492149
$rootScope.$apply();
2150-
tmpl.children().eq(0).children().eq(0).hasClass('has-success').should.be.false;
2150+
tmpl.children().eq(0).hasClass('has-success').should.be.false;
21512151
});
21522152
});
21532153

@@ -2194,10 +2194,10 @@ describe('directive',function(){
21942194
ngModelCtrl.$invalid = true;
21952195
ngModelCtrl.$pristine = false;
21962196
$rootScope.$apply();
2197-
tmpl.children().eq(0).children().eq(0).hasClass('has-error').should.be.true;
2197+
tmpl.children().eq(0).hasClass('has-error').should.be.true;
21982198
scope.form[0].disableErrorState = true;
21992199
$rootScope.$apply();
2200-
tmpl.children().eq(0).children().eq(0).hasClass('has-error').should.be.false;
2200+
tmpl.children().eq(0).hasClass('has-error').should.be.false;
22012201
});
22022202
});
22032203

@@ -2242,10 +2242,10 @@ describe('directive',function(){
22422242
ngModelCtrl.$valid = true;
22432243
ngModelCtrl.$pristine = false;
22442244
$rootScope.$apply();
2245-
tmpl.children().eq(0).children().eq(0).hasClass('has-success').should.be.true;
2245+
tmpl.children().eq(0).hasClass('has-success').should.be.true;
22462246
scope.form[0].disableSuccessState = true;
22472247
$rootScope.$apply();
2248-
tmpl.children().eq(0).children().eq(0).hasClass('has-success').should.be.false;
2248+
tmpl.children().eq(0).hasClass('has-success').should.be.false;
22492249
});
22502250
});
22512251

@@ -2292,10 +2292,10 @@ describe('directive',function(){
22922292
ngModelCtrl.$invalid = true;
22932293
ngModelCtrl.$pristine = false;
22942294
$rootScope.$apply();
2295-
tmpl.children().eq(0).children().eq(0).hasClass('has-error').should.be.true;
2295+
tmpl.children().eq(0).hasClass('has-error').should.be.true;
22962296
scope.form[0].disableErrorState = true;
22972297
$rootScope.$apply();
2298-
tmpl.children().eq(0).children().eq(0).hasClass('has-error').should.be.false;
2298+
tmpl.children().eq(0).hasClass('has-error').should.be.false;
22992299
});
23002300
});
23012301

test/directives/sf-messages-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ describe('directive',function() {
3636

3737
$compile(tmpl)(scope);
3838
$rootScope.$apply();
39-
console.log(tmpl.children().find('div.help-block')[0]);
4039
tmpl.children().find('div.help-block').text().should.equal('foobar');
4140

4241
setTimeout(function() {

0 commit comments

Comments
 (0)