Skip to content

Commit

Permalink
chore(ui5-duration-picker): Add default for max-value (#1924)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilhan007 authored Jul 8, 2020
1 parent 25ed25f commit cd2f9bf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/main/src/DurationPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/main/test/pages/DurationPicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,9 @@

<ui5-duration-picker value="05:10:02" seconds-step="5" id="duration-picker6"></ui5-duration-picker>
<ui5-duration-picker value="05:12" minutes-step="5" hide-seconds id="duration-picker7"></ui5-duration-picker>

<br>
<br>
<ui5-duration-picker id="duration-default"></ui5-duration-picker>
</body>
</html>
30 changes: 22 additions & 8 deletions packages/main/test/specs/DurationPicker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,27 @@ 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");
assert.isOk(popover.getProperty("opened"), "Popover is opened.");

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");
Expand Down Expand Up @@ -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();
});
});

0 comments on commit cd2f9bf

Please sign in to comment.