Skip to content

Commit

Permalink
Change subform repeatable javascript test to correctly check on
Browse files Browse the repository at this point in the history
0-indexed rows, previously they have been 1-indexed.
  • Loading branch information
Rene Pasing committed Sep 12, 2017
1 parent 9b80fba commit f485db8
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/javascript/subform-repeatable/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,31 @@ define(['jquery', 'testsRoot/subform-repeatable/spec-setup', 'jasmineJquery'], f
expect($container.find('tbody').children().length).toEqual(2);
});

it('Should fix the id of the template input checkbox element to "input_checkbox_base-name2_test"', function () {
it('Should fix the id of the template input checkbox element to "input_checkbox_base-name1_test"', function () {
expect($container.find('#input_checkbox_group_test')).not.toExist();
expect($container.find('#input_checkbox_base-name2_test')).toExist();
expect($container.find('#input_checkbox_base-name1_test')).toExist();
});

it('Should fix the for attribute of the checkbox label element to match the changed input id', function () {
expect($container.find('label[for="input_checkbox_base-name2_test"]')).toExist();
expect($container.find('label[for="input_checkbox_base-name1_test"]')).toExist();
});

it('Should fix the name of the template input checkbox element to "input_checkbox[base-name2][test]"', function () {
expect($container.find('#input_checkbox_base-name2_test')).toHaveAttr('name','input_checkbox[base-name2][test]');
it('Should fix the name of the template input checkbox element to "input_checkbox[base-name1][test]"', function () {
expect($container.find('#input_checkbox_base-name1_test')).toHaveAttr('name','input_checkbox[base-name1][test]');
});

it('Should fix the id of the template input radio element to "input_radio_base-name2_test0"', function () {
it('Should fix the id of the template input radio element to "input_radio_base-name1_test0"', function () {
expect($container.find('#input_radio_group_test')).not.toExist();
expect($container.find('#input_radio_base-name2_test0')).toExist();
expect($container.find('#input_radio_base-name1_test0')).toExist();
});

it('Should fix the name of the template input radio element to "input_radio[base-name2][test]"', function () {
expect($container.find('#input_radio_base-name2_test0')).toHaveAttr('name','input_radio[base-name2][test]');
it('Should fix the name of the template input radio element to "input_radio[base-name1][test]"', function () {
expect($container.find('#input_radio_base-name1_test0')).toHaveAttr('name','input_radio[base-name1][test]');
});

it('Should have captured the template correctly', function () {
var $newElement = $container.find('tbody').children().last();

expect($newElement).toContainText('Data 3');
expect($newElement).toContainText('Data 4');
expect($newElement).toContainText('Checkbox label');
Expand All @@ -77,7 +77,7 @@ define(['jquery', 'testsRoot/subform-repeatable/spec-setup', 'jasmineJquery'], f
});

it('Should set data-group attribute to "base-name2" in the new element', function () {
expect($container.find('tbody').children().last()).toHaveAttr('data-group', 'base-name2');
expect($container.find('tbody').children().last()).toHaveAttr('data-group', 'base-name1');
});

it('Should trigger subform-row-add event', function () {
Expand Down

0 comments on commit f485db8

Please sign in to comment.