Skip to content

Commit 91081cb

Browse files
committed
Make tests more resillient
1 parent 7dbc2fb commit 91081cb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/midway/nestingMidwaySpec.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,17 +493,22 @@ describe('nesting', function () {
493493
});
494494

495495
it('enables save button when a subDoc is deleted', function () {
496-
497-
var button = angular.element(elm.find('button')[6]);
496+
var noDocs = scope.record.studies.exams.length;
497+
var buttons = elm.find('button');
498+
var button = angular.element(buttons[buttons.length-2]);
498499
expect(button.text()).toMatch(/Remove/);
499500
scope.remove('studies.exams', 0, {target: button});
501+
expect(scope.record.studies.exams.length).toEqual(noDocs-1);
500502
expect(scope.isSaveDisabled()).toEqual(false);
501503
});
502504

503505
it('enables save button when a subDoc is added', function () {
504-
var button = angular.element(elm.find('button')[7]);
506+
var noDocs = scope.record.studies.exams.length;
507+
var buttons = elm.find('button');
508+
var button = angular.element(buttons[buttons.length-1]);
505509
expect(button.text()).toMatch(/Add/);
506510
scope.add('studies.exams', {target: button});
511+
expect(scope.record.studies.exams.length).toEqual(noDocs+1);
507512
expect(scope.isSaveDisabled()).toEqual(false);
508513
});
509514

0 commit comments

Comments
 (0)