From cd2f9bf44c80aecb3f31c60200eb5f7d397bfe78 Mon Sep 17 00:00:00 2001 From: ilhan orhan Date: Wed, 8 Jul 2020 12:15:30 +0300 Subject: [PATCH] chore(ui5-duration-picker): Add default for max-value (#1924) --- packages/main/src/DurationPicker.js | 3 +- packages/main/test/pages/DurationPicker.html | 4 +++ .../main/test/specs/DurationPicker.spec.js | 30 ++++++++++++++----- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/packages/main/src/DurationPicker.js b/packages/main/src/DurationPicker.js index e0a285353297..c8c40bbd29de 100644 --- a/packages/main/src/DurationPicker.js +++ b/packages/main/src/DurationPicker.js @@ -73,11 +73,12 @@ const metadata = { * Defines a formatted maximal time that the user will be able to adjust. * * @type {string} - * @defaultvalue "00:00:00" + * @defaultvalue "23:59:59" * @public */ maxValue: { type: String, + defaultValue: "23:59:59", }, /** diff --git a/packages/main/test/pages/DurationPicker.html b/packages/main/test/pages/DurationPicker.html index 6eadc3ba25c5..4e41d8c438d3 100644 --- a/packages/main/test/pages/DurationPicker.html +++ b/packages/main/test/pages/DurationPicker.html @@ -58,5 +58,9 @@ + +
+
+ diff --git a/packages/main/test/specs/DurationPicker.spec.js b/packages/main/test/specs/DurationPicker.spec.js index 3fdc03a4d07d..41bdec6a6c00 100644 --- a/packages/main/test/specs/DurationPicker.spec.js +++ b/packages/main/test/specs/DurationPicker.spec.js @@ -10,7 +10,6 @@ describe("Duration Picker general interaction", () => { const staticAreaItemClassName = browser.getStaticAreaItemClassName("#duration-picker1"); const popover = browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover"); - duratationPickerIcon.click(); assert.isOk(durationPicker.getProperty("_isPickerOpen"), "Popover is opened"); @@ -18,20 +17,20 @@ describe("Duration Picker general interaction", () => { duratationPickerIcon.click(); - assert.isNotOk(durationPicker.getProperty("_isPickerOpen"), "Popover is opened"); - assert.isNotOk(popover.getProperty("opened"), "Popover is opened."); - + assert.isNotOk(durationPicker.getProperty("_isPickerOpen"), "Popover is closed"); + assert.isNotOk(popover.getProperty("opened"), "Popover is closed."); }); - it("Tests max value property", () => { + it("Tests max-value", () => { const durationPicker = browser.$("#duration-picker4") const duratationPickerIcon = durationPicker.shadow$(".ui5-duration-picker-input-icon-button"); - + // act duratationPickerIcon.click(); - // The default slot - assert.strictEqual(durationPicker.getProperty("value"),durationPicker.getProperty("maxValue") , "Popover is opened"); + // assert - the custom max-value + assert.strictEqual(durationPicker.getProperty("value"), durationPicker.getProperty("maxValue") , + "The value and the max-vaoue are equal."); assert.strictEqual(durationPicker.getProperty("_maxValue")[0], "05", "max value is read correctly"); assert.strictEqual(durationPicker.getProperty("_maxValue")[1], "10", "max value is read correctly"); assert.strictEqual(durationPicker.getProperty("_maxValue")[2], "08", "max value is read correctly"); @@ -81,4 +80,19 @@ describe("Duration Picker general interaction", () => { assert.strictEqual(durationPicker.getProperty("value"), "20:10", "Minutes and seconds are considered"); }); + it("Tests default max-value", () => { + const durationPicker = browser.$("#duration-default") + const duratationPickerIcon = durationPicker.shadow$(".ui5-duration-picker-input-icon-button"); + + // act + duratationPickerIcon.click(); + + // assert - the default max-value + assert.strictEqual(durationPicker.getProperty("_maxValue")[0], "23", "max value is read correctly"); + assert.strictEqual(durationPicker.getProperty("_maxValue")[1], "59", "max value is read correctly"); + assert.strictEqual(durationPicker.getProperty("_maxValue")[2], "59", "max value is read correctly"); + + // close picker + duratationPickerIcon.click(); + }); });