diff --git a/.eslintrc.json b/.eslintrc.json index d34030c0..23562c0c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -44,10 +44,13 @@ "globals": { "Polymer": false, "MealOrderApp": true, + "MealOrderAppTest": true, "assert": false, "test": false, "suite": false, "fixture": false, - "setup": false + "setup": false, + "flush": false, + "sinon": false } } diff --git a/client/user/bower.json b/client/user/bower.json index f4c026ef..0f7d1b39 100644 --- a/client/user/bower.json +++ b/client/user/bower.json @@ -6,8 +6,11 @@ "polymer": "Polymer/polymer#^2.0.0", "app-layout": "PolymerElements/app-layout#^2.0.0", "app-route": "PolymerElements/app-route#^2.0.0", - "iron-form": "PolymerElements/iron-form#^2.0.0", - "polymer-redux": "^1.0.5" + "polymer-redux": "^1.0.5", + "iron-pages": "PolymerElements/iron-pages#^2.1.0", + "paper-tabs": "PolymerElements/paper-tabs#^2.1.0", + "iron-icons": "PolymerElements/iron-icons#^2.1.1", + "app-datepicker": "motss/app-datepicker#^2.12.0" }, "devDependencies": { "web-component-tester": "Polymer/web-component-tester#^6.0.0", diff --git a/client/user/index.html b/client/user/index.html index e756040a..f3bd02d2 100644 --- a/client/user/index.html +++ b/client/user/index.html @@ -1,4 +1,3 @@ - - - - - - - - + href="../../bower_components/app-layout/app-scroll-effects/effects/waterfall.html"> + + + + + + + + + + - diff --git a/client/user/src/mealorder/meal-order-toolbar.html b/client/user/src/mealorder/meal-order-toolbar.html new file mode 100644 index 00000000..26c0ee63 --- /dev/null +++ b/client/user/src/mealorder/meal-order-toolbar.html @@ -0,0 +1,147 @@ + + + + + + + + + + + diff --git a/client/user/src/mealorder/menu/meal-order-drawer.html b/client/user/src/mealorder/menu/meal-order-drawer.html new file mode 100644 index 00000000..31d0e64f --- /dev/null +++ b/client/user/src/mealorder/menu/meal-order-drawer.html @@ -0,0 +1,188 @@ + + + + + + + + + + diff --git a/client/user/src/mealorder/menu/meal-order-menu-container.html b/client/user/src/mealorder/menu/meal-order-menu-container.html new file mode 100644 index 00000000..edfdb12c --- /dev/null +++ b/client/user/src/mealorder/menu/meal-order-menu-container.html @@ -0,0 +1,234 @@ + + + + + + + + + + + diff --git a/client/user/src/mealorder/shell/actions/user-actions.html b/client/user/src/mealorder/shell/actions/user-actions.html new file mode 100644 index 00000000..73c583b4 --- /dev/null +++ b/client/user/src/mealorder/shell/actions/user-actions.html @@ -0,0 +1,22 @@ + + diff --git a/client/user/src/mealorder/shell/reducers/reducers.html b/client/user/src/mealorder/shell/reducers/reducers.html index 5a8a7729..90c48dee 100644 --- a/client/user/src/mealorder/shell/reducers/reducers.html +++ b/client/user/src/mealorder/shell/reducers/reducers.html @@ -18,19 +18,124 @@ ~ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - diff --git a/client/user/src/mealorder/shell/redux-store.html b/client/user/src/mealorder/shell/redux-store.html index ef87ca10..bad13dc4 100644 --- a/client/user/src/mealorder/shell/redux-store.html +++ b/client/user/src/mealorder/shell/redux-store.html @@ -17,9 +17,8 @@ ~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ~ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> - - + - - + @@ -51,16 +48,45 @@ let component; setup(() => { - component = fixture('BasicClientApp'); + component = fixture('MealOrderClientApp'); }); - test('should parse url correctly', function () { + + test('should parse `routeData.page` correctly', function () { setLocation('/#/history/'); assert.equal('history', component.routeData.page); setLocation('/#/menu/'); assert.equal('menu', component.routeData.page); }); + + test('should parse `routeData.date` correctly', function () { + setLocation('/#/history/2018-03-21'); + assert.equal('2018-03-21', component.routeData.date); + setLocation('/#/menu/2018-03-21'); + assert.equal('2018-03-21', component.routeData.date); + }); + + test('should instantiate the `meal-order-toolbar` component', function (done) { + const elementShadowRoot = component.shadowRoot; + const drawer = elementShadowRoot.querySelector("meal-order-toolbar"); + assert.equal(drawer.tagName.toLocaleLowerCase(), MealOrderApp.MealOrderToolbar.is); + done(); + }); + + test('should instantiate the `meal-order-drawer` component', function (done) { + const elementShadowRoot = component.shadowRoot; + const drawer = elementShadowRoot.querySelector("meal-order-drawer"); + assert.equal(drawer.tagName.toLocaleLowerCase(), MealOrderApp.MealOrderDrawer.is); + done(); + }); + + test('should instantiate the `meal-order-menu-container` component ' + + 'with data-page `menu`', function () { + setLocation('/#/menu/2018-03-23'); + const pages = component.shadowRoot.querySelector('#app-header-layout-iron'); + pages.forceSynchronousItemUpdate(); + assert.equal(pages.selectedItem.tagName.toLocaleLowerCase(), MealOrderApp.MealOrderMenuContainer.is); + }); }); - diff --git a/client/user/test/mealorder/meal-order-drawer_test.html b/client/user/test/mealorder/meal-order-drawer_test.html new file mode 100644 index 00000000..f78adc84 --- /dev/null +++ b/client/user/test/mealorder/meal-order-drawer_test.html @@ -0,0 +1,121 @@ + + + + + + + meal-order-client test + + + + + + + + + + + + + + + diff --git a/client/user/test/mealorder/meal-order-menu-container_test.html b/client/user/test/mealorder/meal-order-menu-container_test.html new file mode 100644 index 00000000..bdc5e4f0 --- /dev/null +++ b/client/user/test/mealorder/meal-order-menu-container_test.html @@ -0,0 +1,67 @@ + + + + + + + meal-order-menu-container test + + + + + + + + + + + + + + + diff --git a/client/user/test/mealorder/meal-order-toolbar_test.html b/client/user/test/mealorder/meal-order-toolbar_test.html new file mode 100644 index 00000000..ae489529 --- /dev/null +++ b/client/user/test/mealorder/meal-order-toolbar_test.html @@ -0,0 +1,78 @@ + + + + + + + meal-order-toolbar test + + + + + + + + + + + + + + diff --git a/client/user/test/mealorder/test_variables.js b/client/user/test/mealorder/test_variables.js new file mode 100644 index 00000000..179099e8 --- /dev/null +++ b/client/user/test/mealorder/test_variables.js @@ -0,0 +1,22 @@ +/* + * Copyright 2018, TeamDev Ltd. All rights reserved. + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +{ + window.MealOrderAppTest = window.MealOrderAppTest || {}; +}