From 11aee56916c71648d80ee066030f46f172485015 Mon Sep 17 00:00:00 2001 From: Joel Kent Date: 2016年4月16日 23:57:52 +0100 Subject: [PATCH 1/6] Sortable tab array --- src/tabarray.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tabarray.html b/src/tabarray.html index e7a5b8a..e6e3c02 100644 --- a/src/tabarray.html +++ b/src/tabarray.html @@ -6,8 +6,9 @@ class="clearfix schema-form-tabarray schema-form-tabarray-{{form.tabType || 'left'}} {{form.htmlClass}}">
- +
From 0a8858615954f242e333bdcdb12e81b919a2a439 Mon Sep 17 00:00:00 2001 From: Joel Kent Date: 2016年4月18日 10:20:36 +0100 Subject: [PATCH 2/6] Support for sortOptions The ui-sortable directive is now passed sortOptions. sortOptions.items defaults to ignore the last list item. --- src/bootstrap-decorator.js | 13 ++++++++++++- src/tabarray.html | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/bootstrap-decorator.js b/src/bootstrap-decorator.js index 8c20653..1deb784 100644 --- a/src/bootstrap-decorator.js +++ b/src/bootstrap-decorator.js @@ -27,13 +27,24 @@ function(decoratorsProvider, sfBuilderProvider, sfPathProvider) { }); } }; + + // Set tabArray sortOptions.items default. + var tabArray = function(args) { + if(args.form.hasOwnProperty('sortOptions')) { + if(!args.form.sortOptions.hasOwnProperty('items')) { + args.form.sortOptions['items'] = 'li:not(:last-child)'; + } + } else { + args.form['sortOptions'] = {items: 'li:not(:last-child)'}; + } + } var defaults = [sfField, ngModel, ngModelOptions, condition]; decoratorsProvider.defineDecorator('bootstrapDecorator', { textarea: {template: base + 'textarea.html', builder: defaults}, fieldset: {template: base + 'fieldset.html', builder: [sfField, simpleTransclusion, condition]}, array: {template: base + 'array.html', builder: [sfField, ngModelOptions, ngModel, array, condition]}, - tabarray: {template: base + 'tabarray.html', builder: [sfField, ngModelOptions, ngModel, array, condition]}, + tabarray: {template: base + 'tabarray.html', builder: [sfField, ngModelOptions, ngModel, array, condition, tabArray]}, tabs: {template: base + 'tabs.html', builder: [sfField, ngModelOptions, tabs, condition]}, section: {template: base + 'section.html', builder: [sfField, simpleTransclusion, condition]}, conditional: {template: base + 'section.html', builder: [sfField, simpleTransclusion, condition]}, diff --git a/src/tabarray.html b/src/tabarray.html index e6e3c02..45bfbb9 100644 --- a/src/tabarray.html +++ b/src/tabarray.html @@ -8,7 +8,7 @@ ng-class="{'col-xs-3': !form.tabType || form.tabType === 'left'}">
    + sf-field-model ui-sortable="form.sortOptions">
  1. Date: 2016年4月25日 21:32:35 +0100 Subject: [PATCH 3/6] Example and protractor test for sortable tab arrays --- examples/sortable-tabarray.html | 68 ++++++++++++++++++++++ gulp/tasks/protractor.js | 2 +- test/protractor/specs/sortable-tabarray.js | 63 ++++++++++++++++++++ 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 examples/sortable-tabarray.html create mode 100644 test/protractor/specs/sortable-tabarray.js diff --git a/examples/sortable-tabarray.html b/examples/sortable-tabarray.html new file mode 100644 index 0000000..50db452 --- /dev/null +++ b/examples/sortable-tabarray.html @@ -0,0 +1,68 @@ + + + + + Sortable tabArray + + + + + + + + + + + + + + + + + + + + +
    +

    Sortable Tab Array

    +

    Drag and drop tabs to order the elements in the array

    +
    +
    +
    +

    AltStyle によって変換されたページ (->オリジナル) /

    + diff --git a/gulp/tasks/protractor.js b/gulp/tasks/protractor.js index 9a3bb18..aaee0c6 100644 --- a/gulp/tasks/protractor.js +++ b/gulp/tasks/protractor.js @@ -27,7 +27,7 @@ gulp.task('protractor', ['webdriver-update'], function(cb) { }).on('end', cb); }); -['validation-messages', 'custom-validation'].forEach(function(name) { +['validation-messages', 'custom-validation', 'sortable-tabarray'].forEach(function(name) { gulp.task('protractor:' + name, ['webdriver-update'], function(cb) { gulp.src(['test/protractor/specs/' + name + '.js']).pipe(protractor.protractor({ configFile: 'test/protractor/conf.js', diff --git a/test/protractor/specs/sortable-tabarray.js b/test/protractor/specs/sortable-tabarray.js new file mode 100644 index 0000000..a18611c --- /dev/null +++ b/test/protractor/specs/sortable-tabarray.js @@ -0,0 +1,63 @@ +describe('sortable tabarray', function () { + function checkDragDrop(i) { + browser.driver.wait(protractor.until.elementLocated(by.xpath("//ol/li[1]/a[text()='My name is: Name " + (i + 1) +"']")), 10000); + expect(element.all(by.css('.nav-tabs li a')).get(0).getText()).toBe('My name is: Name ' + (i + 1)); + } + + function populateTab(i) { + browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.active.index' + i)), 5000); + + browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.index' + i + ' div.nickField> input')), 5000); + input = element.all(by.css('.tab-pane.index' + i + ' div.nickField> input')).first(); + input.sendKeys('Nickname ' + i); + + browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.index' + i + ' div.nameField> input')), 5000); + input = element.all(by.css('.tab-pane.index' + i + ' div.nameField> input')).first(); + input.sendKeys('Name ' + i); + + browser.driver.wait(protractor.until.elementLocated(by.linkText('My name is: Name ' + i)), 10000); + } + + it('form should exist', function () { + browser.get('http://localhost:8080/examples/sortable-tabarray.html'); + + expect(element(by.css('form')).getInnerHtml()).not.toEqual(''); + }); + + it('should be able order elements in array by dragging the tabs', function () { + browser.get('http://localhost:8080/examples/sortable-tabarray.html'); + + var i; + var elementsToAdd = 9; + + /* the array starts with 1 element, populate the first element */ + populateTab(0); + + /* add elements and populate */ + for (i = 1; i <= elementsToAdd; i++) { + var tabLink = element.all(by.css('.glyphicon-plus')); + tabLink.click().then(populateTab(i)); + } + + /* continue when all tabs have been populated*/ + browser.driver.wait(protractor.until.elementLocated(by.linkText('My name is: Name ' + elementsToAdd)), 10000); + + /* check the number of tabs */ + var tabs = element.all(by.css('.nav-tabs li')); + expect(tabs.count()).toBe(elementsToAdd + 2); //Extra 1 for the "+ Add" link + + /* drag the tabs into reverse order (descending) */ + for (i = 0; i < elementsToAdd; i++) { + var draggable_element = element.all(by.css('.nav-tabs li')).get(0); + var target_element = element.all(by.css('.nav-tabs li')).get(elementsToAdd - i); + expect(draggable_element.isPresent()).toEqual(true); + expect(target_element.isPresent()).toEqual(true); + browser.actions().dragAndDrop(draggable_element, target_element).perform().then(checkDragDrop(i)); + } + + /* final check of the reverse ordered tabs */ + for (i = 0; i <= elementsToAdd; i++) { + expect(element.all(by.css('.nav-tabs li a')).get(i).getText()).toBe('My name is: Name ' + (elementsToAdd - i)); + } + }); +}); \ No newline at end of file From 857b5f88c7059085e49c1b346059cf7fa136ec87 Mon Sep 17 00:00:00 2001 From: Joel Kent Date: 2016年4月26日 16:59:21 +0100 Subject: [PATCH 4/6] Hide the Add link and Remove button if set to null Tab array updated to behave the same as arrays where the Add link and Remove button are hidden if set to null --- src/tabarray.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tabarray.html b/src/tabarray.html index 45bfbb9..1e8de1b 100644 --- a/src/tabarray.html +++ b/src/tabarray.html @@ -15,7 +15,7 @@ ng-class="{active: selected.tab === $index}"> {{interp(form.title,{'$index':$index, value: item}) || $index}}
  2. -
  3. @@ -36,7 +36,7 @@ -
  4. -
  5. From a24eebc44dc5f8dad3e933da7d1b26f1d76e7d6c Mon Sep 17 00:00:00 2001 From: Joel Kent Date: 2016年4月27日 16:36:03 +0100 Subject: [PATCH 5/6] Example and tests include hiding Add and Remove The example has been extended to include 4 tab array demos: standard, add link disabled, remove button disabled and drag and drop sortable. The protractor tests have been extended to test add link disabled and remove button disabled. --- examples/sortable-tabarray.html | 68 ------- examples/tabarray.html | 202 +++++++++++++++++++++ gulp/tasks/protractor.js | 2 +- test/protractor/specs/sortable-tabarray.js | 63 ------- test/protractor/specs/tabarray.js | 109 +++++++++++ 5 files changed, 312 insertions(+), 132 deletions(-) delete mode 100644 examples/sortable-tabarray.html create mode 100644 examples/tabarray.html delete mode 100644 test/protractor/specs/sortable-tabarray.js create mode 100644 test/protractor/specs/tabarray.js diff --git a/examples/sortable-tabarray.html b/examples/sortable-tabarray.html deleted file mode 100644 index 50db452..0000000 --- a/examples/sortable-tabarray.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Sortable tabArray - - - - - - - - - - - - - - - - - - - - - -

    Sortable Tab Array

    -

    Drag and drop tabs to order the elements in the array

    -
    -
    -
    - - diff --git a/examples/tabarray.html b/examples/tabarray.html new file mode 100644 index 0000000..52cb8dc --- /dev/null +++ b/examples/tabarray.html @@ -0,0 +1,202 @@ + + + + + Tab Array Demo + + + + + + + + + + + + + + + + + + + + + +

    Tab Array Demo

    +

    Drag and drop tabs to order the elements in the array

    +
    +
    +
    + + diff --git a/gulp/tasks/protractor.js b/gulp/tasks/protractor.js index aaee0c6..9c410e8 100644 --- a/gulp/tasks/protractor.js +++ b/gulp/tasks/protractor.js @@ -27,7 +27,7 @@ gulp.task('protractor', ['webdriver-update'], function(cb) { }).on('end', cb); }); -['validation-messages', 'custom-validation', 'sortable-tabarray'].forEach(function(name) { +['validation-messages', 'custom-validation', 'tabarray'].forEach(function(name) { gulp.task('protractor:' + name, ['webdriver-update'], function(cb) { gulp.src(['test/protractor/specs/' + name + '.js']).pipe(protractor.protractor({ configFile: 'test/protractor/conf.js', diff --git a/test/protractor/specs/sortable-tabarray.js b/test/protractor/specs/sortable-tabarray.js deleted file mode 100644 index a18611c..0000000 --- a/test/protractor/specs/sortable-tabarray.js +++ /dev/null @@ -1,63 +0,0 @@ -describe('sortable tabarray', function () { - function checkDragDrop(i) { - browser.driver.wait(protractor.until.elementLocated(by.xpath("//ol/li[1]/a[text()='My name is: Name " + (i + 1) +"']")), 10000); - expect(element.all(by.css('.nav-tabs li a')).get(0).getText()).toBe('My name is: Name ' + (i + 1)); - } - - function populateTab(i) { - browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.active.index' + i)), 5000); - - browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.index' + i + ' div.nickField> input')), 5000); - input = element.all(by.css('.tab-pane.index' + i + ' div.nickField> input')).first(); - input.sendKeys('Nickname ' + i); - - browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.index' + i + ' div.nameField> input')), 5000); - input = element.all(by.css('.tab-pane.index' + i + ' div.nameField> input')).first(); - input.sendKeys('Name ' + i); - - browser.driver.wait(protractor.until.elementLocated(by.linkText('My name is: Name ' + i)), 10000); - } - - it('form should exist', function () { - browser.get('http://localhost:8080/examples/sortable-tabarray.html'); - - expect(element(by.css('form')).getInnerHtml()).not.toEqual(''); - }); - - it('should be able order elements in array by dragging the tabs', function () { - browser.get('http://localhost:8080/examples/sortable-tabarray.html'); - - var i; - var elementsToAdd = 9; - - /* the array starts with 1 element, populate the first element */ - populateTab(0); - - /* add elements and populate */ - for (i = 1; i <= elementsToAdd; i++) { - var tabLink = element.all(by.css('.glyphicon-plus')); - tabLink.click().then(populateTab(i)); - } - - /* continue when all tabs have been populated*/ - browser.driver.wait(protractor.until.elementLocated(by.linkText('My name is: Name ' + elementsToAdd)), 10000); - - /* check the number of tabs */ - var tabs = element.all(by.css('.nav-tabs li')); - expect(tabs.count()).toBe(elementsToAdd + 2); //Extra 1 for the "+ Add" link - - /* drag the tabs into reverse order (descending) */ - for (i = 0; i < elementsToAdd; i++) { - var draggable_element = element.all(by.css('.nav-tabs li')).get(0); - var target_element = element.all(by.css('.nav-tabs li')).get(elementsToAdd - i); - expect(draggable_element.isPresent()).toEqual(true); - expect(target_element.isPresent()).toEqual(true); - browser.actions().dragAndDrop(draggable_element, target_element).perform().then(checkDragDrop(i)); - } - - /* final check of the reverse ordered tabs */ - for (i = 0; i <= elementsToAdd; i++) { - expect(element.all(by.css('.nav-tabs li a')).get(i).getText()).toBe('My name is: Name ' + (elementsToAdd - i)); - } - }); -}); \ No newline at end of file diff --git a/test/protractor/specs/tabarray.js b/test/protractor/specs/tabarray.js new file mode 100644 index 0000000..656e057 --- /dev/null +++ b/test/protractor/specs/tabarray.js @@ -0,0 +1,109 @@ +describe('tab array', function () { + it('form should exist', function () { + browser.get('http://localhost:8080/examples/tabarray.html'); + + expect(element(by.css('form')).getInnerHtml()).not.toEqual(''); + }); + + it('add link should be hidden', function () { + browser.get('http://localhost:8080/examples/tabarray.html'); + + /* select the add disabled example */ + element(by.css('[name="exampleSelector"]')).element(by.cssContainingText('option', 'Add Disabled')).click().then(function() { + + /* Add link should not be displayed */ + var tabs = element.all(by.css('.nav-tabs li')); + expect(tabs.get(0).isDisplayed()).toBeTruthy(); + expect(tabs.get(1).isDisplayed()).toBeFalsy(); + + var addLink = element.all(by.partialLinkText('Add')); + expect(addLink.count()).toBe(0); + + /*** control tests ***/ + /* Remove button should be displayed */ + var removeButton = element.all(by.partialButtonText('Remove')).get(0); + expect(removeButton.isDisplayed()).toBeTruthy(); + }); + }); + + it('remove button should be hidden', function () { + browser.get('http://localhost:8080/examples/tabarray.html'); + + /* select the remove disabled example */ + element(by.css('[name="exampleSelector"]')).element(by.cssContainingText('option', 'Remove Disabled')).click().then(function() { + + /* Remove button should not be displayed */ + var removeButton = element.all(by.partialButtonText('Remove')).get(0); + expect(removeButton.isDisplayed()).toBeFalsy(); + + /*** control tests ***/ + /* Add link should not be displayed */ + var tabs = element.all(by.css('.nav-tabs li')); + expect(tabs.get(0).isDisplayed()).toBeTruthy(); + expect(tabs.get(1).isDisplayed()).toBeTruthy(); + + var addLink = element.all(by.partialLinkText('Add')); + expect(addLink.count()).toBe(1); + }); + }); + + it('should be able order elements in array by dragging the tabs', function () { + browser.get('http://localhost:8080/examples/tabarray.html'); + + function checkDragDrop(i) { + browser.driver.wait(protractor.until.elementLocated(by.xpath("//ol/li[1]/a[text()='My name is: Name " + (i + 1) +"']")), 10000); + expect(element.all(by.css('.nav-tabs li a')).get(0).getText()).toBe('My name is: Name ' + (i + 1)); + } + + function populateTab(i) { + browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.active.index' + i)), 5000); + + browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.index' + i + ' div.nickField> input')), 5000); + input = element.all(by.css('.tab-pane.index' + i + ' div.nickField> input')).first(); + input.sendKeys('Nickname ' + i); + + browser.driver.wait(protractor.until.elementLocated(by.css('.tab-pane.index' + i + ' div.nameField> input')), 5000); + input = element.all(by.css('.tab-pane.index' + i + ' div.nameField> input')).first(); + input.sendKeys('Name ' + i); + + browser.driver.wait(protractor.until.elementLocated(by.linkText('My name is: Name ' + i)), 10000); + } + + /* select the sortable example */ + element(by.css('[name="exampleSelector"]')).element(by.cssContainingText('option', 'Sortable')).click().then(function() { + + var i; + var elementsToAdd = 9; + + /* the array starts with 1 element, populate the first element */ + populateTab(0); + + /* add elements and populate */ + for (i = 1; i <= elementsToAdd; i++) { + var tabLink = element.all(by.css('.glyphicon-plus')); + tabLink.click().then(populateTab(i)); + } + + /* continue when all tabs have been populated*/ + browser.driver.wait(protractor.until.elementLocated(by.linkText('My name is: Name ' + elementsToAdd)), 10000); + + /* check the number of tabs */ + var tabs = element.all(by.css('.nav-tabs li')); + expect(tabs.count()).toBe(elementsToAdd + 2); //Extra 1 for the "+ Add" link + + /* drag the tabs into reverse order (descending) */ + for (i = 0; i < elementsToAdd; i++) { + var draggable_element = element.all(by.css('.nav-tabs li')).get(0); + var target_element = element.all(by.css('.nav-tabs li')).get(elementsToAdd - i); + expect(draggable_element.isPresent()).toEqual(true); + expect(target_element.isPresent()).toEqual(true); + browser.actions().dragAndDrop(draggable_element, target_element).perform().then(checkDragDrop(i)); + } + + /* final check of the reverse ordered tabs */ + for (i = 0; i <= elementsToAdd; i++) { + expect(element.all(by.css('.nav-tabs li a')).get(i).getText()).toBe('My name is: Name ' + (elementsToAdd - i)); + } + }); + }); +}); From 2308fe5b5b006a4c119bd20184bfa775319116a0 Mon Sep 17 00:00:00 2001 From: Joel Kent Date: 2016年5月23日 21:29:42 +0100 Subject: [PATCH 6/6] Move tab array examples to the existing bootstrap example --- examples/bootstrap-example.html | 9 +- examples/data/tabarray-add-disabled.json | 44 +++++ examples/data/tabarray-remove-disabled.json | 44 +++++ examples/data/tabarray-sortable.json | 40 ++++ examples/tabarray.html | 202 -------------------- test/protractor/specs/tabarray.js | 20 +- 6 files changed, 145 insertions(+), 214 deletions(-) create mode 100644 examples/data/tabarray-add-disabled.json create mode 100644 examples/data/tabarray-remove-disabled.json create mode 100644 examples/data/tabarray-sortable.json delete mode 100644 examples/tabarray.html diff --git a/examples/bootstrap-example.html b/examples/bootstrap-example.html index 5bef56a..c7908b2 100644 --- a/examples/bootstrap-example.html +++ b/examples/bootstrap-example.html @@ -214,9 +214,9 @@

    Schema

    - + + + @@ -254,6 +254,9 @@

    Schema

    { name: "TitleMap Examples", data: 'data/titlemaps.json' }, { name: "Kitchen Sink", data: 'data/sink.json' }, { name: "Hack: Conditional required", data: 'data/conditional-required.json' }, + { name: "Tab Array: Add Disabled", data: 'data/tabarray-add-disabled.json' }, + { name: "Tab Array: Remove Disabled", data: 'data/tabarray-remove-disabled.json' }, + { name: "Tab Array: Sortable (Drag and Drop)", data: 'data/tabarray-sortable.json' } ]; $scope.navbarMode = 'default'; diff --git a/examples/data/tabarray-add-disabled.json b/examples/data/tabarray-add-disabled.json new file mode 100644 index 0000000..b604e22 --- /dev/null +++ b/examples/data/tabarray-add-disabled.json @@ -0,0 +1,44 @@ +{ + "schema": { + "type": "object", + "title": "Tab Array: Add Disabled", + "properties": { + "addDisabledTabArray": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "nick": { "type": "string" } + } + } + } + } + }, + "form": [ + { + "type": "section", + "htmlCss": "row", + "items": [ + { + "type": "help", + "helpvalue": "

    Tab array with add link hidden

    " + }, + { + "key": "addDisabledTabArray", + "type": "tabarray", + "add": null, + "title": "My name is: {{ value.name }}", + "sortOptions": { + "disabled": true + }, + "items" : [ + {"key": "addDisabledTabArray[].name", "htmlClass": "nameField"}, + {"key": "addDisabledTabArray[].nick", "htmlClass": "nickField"} + ] + } + ] + } + ], + "model": {} +} diff --git a/examples/data/tabarray-remove-disabled.json b/examples/data/tabarray-remove-disabled.json new file mode 100644 index 0000000..74e818e --- /dev/null +++ b/examples/data/tabarray-remove-disabled.json @@ -0,0 +1,44 @@ +{ + "schema": { + "type": "object", + "title": "Tab Array: Remove Disabled", + "properties": { + "removeDisabledTabArray": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "nick": { "type": "string" } + } + } + } + } + }, + "form": [ + { + "type": "section", + "htmlCss": "row", + "items": [ + { + "type": "help", + "helpvalue": "

    Tab array with remove button hidden

    " + }, + { + "key": "removeDisabledTabArray", + "type": "tabarray", + "remove": null, + "title": "My name is: {{ value.name }}", + "sortOptions": { + "disabled": true + }, + "items" : [ + {"key": "removeDisabledTabArray[].name", "htmlClass": "nameField"}, + {"key": "removeDisabledTabArray[].nick", "htmlClass": "nickField"} + ] + } + ] + } + ], + "model": {} +} diff --git a/examples/data/tabarray-sortable.json b/examples/data/tabarray-sortable.json new file mode 100644 index 0000000..3eda316 --- /dev/null +++ b/examples/data/tabarray-sortable.json @@ -0,0 +1,40 @@ +{ + "schema": { + "type": "object", + "title": "Tab Array: Sortable (Drag and Drop)", + "properties": { + "sortableTabArray": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "nick": { "type": "string" } + } + } + } + } + }, + "form": [ + { + "type": "section", + "htmlCss": "row", + "items": [ + { + "type": "help", + "helpvalue": "

    Drag and drop sortable tab array

    " + }, + { + "key": "sortableTabArray", + "type": "tabarray", + "title": "My name is: {{ value.name }}", + "items" : [ + {"key": "sortableTabArray[].name", "htmlClass": "nameField"}, + {"key": "sortableTabArray[].nick", "htmlClass": "nickField"} + ] + } + ] + } + ], + "model": {} +} diff --git a/examples/tabarray.html b/examples/tabarray.html deleted file mode 100644 index 52cb8dc..0000000 --- a/examples/tabarray.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - Tab Array Demo - - - - - - - - - - - - - - - - - - - - - -

    Tab Array Demo

    -

    Drag and drop tabs to order the elements in the array

    -
    -
    -
    - - diff --git a/test/protractor/specs/tabarray.js b/test/protractor/specs/tabarray.js index 656e057..03f5e3f 100644 --- a/test/protractor/specs/tabarray.js +++ b/test/protractor/specs/tabarray.js @@ -1,15 +1,17 @@ describe('tab array', function () { it('form should exist', function () { - browser.get('http://localhost:8080/examples/tabarray.html'); - - expect(element(by.css('form')).getInnerHtml()).not.toEqual(''); + browser.get('http://localhost:8080/examples/bootstrap-example.html'); + + element(by.css('#selectTest')).all(by.cssContainingText('option', 'Tab Array')).first().click().then(function() { + expect(element(by.css('form.ng-valid-schema-form')).getInnerHtml()).not.toEqual(''); + }); }); it('add link should be hidden', function () { - browser.get('http://localhost:8080/examples/tabarray.html'); + browser.get('http://localhost:8080/examples/bootstrap-example.html'); /* select the add disabled example */ - element(by.css('[name="exampleSelector"]')).element(by.cssContainingText('option', 'Add Disabled')).click().then(function() { + element(by.css('#selectTest')).element(by.cssContainingText('option', 'Tab Array: Add Disabled')).click().then(function() { /* Add link should not be displayed */ var tabs = element.all(by.css('.nav-tabs li')); @@ -27,10 +29,10 @@ describe('tab array', function () { }); it('remove button should be hidden', function () { - browser.get('http://localhost:8080/examples/tabarray.html'); + browser.get('http://localhost:8080/examples/bootstrap-example.html'); /* select the remove disabled example */ - element(by.css('[name="exampleSelector"]')).element(by.cssContainingText('option', 'Remove Disabled')).click().then(function() { + element(by.css('#selectTest')).element(by.cssContainingText('option', 'Tab Array: Remove Disabled')).click().then(function() { /* Remove button should not be displayed */ var removeButton = element.all(by.partialButtonText('Remove')).get(0); @@ -48,7 +50,7 @@ describe('tab array', function () { }); it('should be able order elements in array by dragging the tabs', function () { - browser.get('http://localhost:8080/examples/tabarray.html'); + browser.get('http://localhost:8080/examples/bootstrap-example.html'); function checkDragDrop(i) { browser.driver.wait(protractor.until.elementLocated(by.xpath("//ol/li[1]/a[text()='My name is: Name " + (i + 1) +"']")), 10000); @@ -70,7 +72,7 @@ describe('tab array', function () { } /* select the sortable example */ - element(by.css('[name="exampleSelector"]')).element(by.cssContainingText('option', 'Sortable')).click().then(function() { + element(by.css('#selectTest')).element(by.cssContainingText('option', 'Tab Array: Sortable')).click().then(function() { var i; var elementsToAdd = 9;