Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-flexible-column-layout): Fix media breakpoints #1984

Merged
merged 2 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/fiori/src/FlexibleColumnLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ class FlexibleColumnLayout extends UI5Element {

static get BREAKPOINTS() {
return {
"M": 960,
"L": 1280,
"PHONE": 599,
"TABLET": 1023,
};
}

Expand Down Expand Up @@ -563,11 +563,11 @@ class FlexibleColumnLayout extends UI5Element {
}

get media() {
if (this._width <= FlexibleColumnLayout.BREAKPOINTS.M) {
if (this._width <= FlexibleColumnLayout.BREAKPOINTS.PHONE) {
return FlexibleColumnLayout.MEDIA.PHONE;
}

if (this._width <= FlexibleColumnLayout.BREAKPOINTS.L) {
if (this._width <= FlexibleColumnLayout.BREAKPOINTS.TABLET) {
return FlexibleColumnLayout.MEDIA.TABLET;
}

Expand Down
17 changes: 9 additions & 8 deletions packages/fiori/test/specs/FCL.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ describe("FlexibleColumnLayout Behavior", () => {
assert.strictEqual(layoutChangeCounter.getValue(), "1", "The event layout-change is not fired.");
});

it("tests Tablet Size 1200px", () => {
it("tests Tablet Size 1000px", () => {
// act
browser.setWindowSize(1200, 1080);
browser.setWindowSize(1000, 1080);

const layoutChangeCounter = browser.$("#testLayoutChange");
const visibleColumns = browser.execute(() => {
Expand All @@ -35,9 +35,9 @@ describe("FlexibleColumnLayout Behavior", () => {
assert.strictEqual(layoutChangeCounter.getValue(), "2", "The event layout-change after resizing.");
});

it("tests Phone size 870px", () => {
it("tests Phone size 500px", () => {
// act
browser.setWindowSize(870, 1080);
browser.setWindowSize(500, 1080);

const layoutChangeCounter = browser.$("#testLayoutChange");
const visibleColumns = browser.execute(() => {
Expand All @@ -57,19 +57,20 @@ describe("FlexibleColumnLayout Behavior", () => {
const fcl = browser.$("#fcl1");
const layoutChangeCounter = browser.$("#layoutChangeRes4");
const arrow = fcl.shadow$(".ui5-fcl-arrow--start");
let counter = parseInt(layoutChangeCounter.getValue()) || 0;

// act
arrow.click();

// assert (two times the event has been fired due resize already)
assert.strictEqual(layoutChangeCounter.getValue(), "4", "The event layout-change fired once.");
// assert
assert.strictEqual(layoutChangeCounter.getValue(), `${++counter}`, "The event layout-change fired once.");
assert.strictEqual(fcl.getProperty("layout"), "TwoColumnsMidExpanded", "new layout set");

// act
arrow.click();

// // assert
assert.strictEqual(layoutChangeCounter.getValue(), "5", "The event layout-change fired again.");
// assert
assert.strictEqual(layoutChangeCounter.getValue(), `${++counter}`, "The event layout-change fired again.");
assert.strictEqual(fcl.getProperty("layout"), "TwoColumnsStartExpanded", "new layout set");
});

Expand Down