Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ declare class MasterDetailLayout extends ThemableMixin(ElementMixin(HTMLElement)
/**
* Controls which column(s) expand to fill available space.
* Possible values: `'master'`, `'detail'`, `'both'`.
* Defaults to `'both'`.
* Defaults to `'master'`.
*/
expand: 'master' | 'detail' | 'both';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ class MasterDetailLayout extends ElementMixin(ThemableMixin(PolylitMixin(LitElem
/**
* Controls which column(s) expand to fill available space.
* Possible values: `'master'`, `'detail'`, `'both'`.
* Defaults to `'both'`.
* Defaults to `'master'`.
*/
expand: {
type: String,
value: 'both',
value: 'master',
reflectToAttribute: true,
sync: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const snapshots = {};

snapshots["vaadin-master-detail-layout host default"] =
`<vaadin-master-detail-layout
expand="both"
expand="master"
orientation="horizontal"
overlay-containment="layout"
>
Expand All @@ -22,7 +22,7 @@ snapshots["vaadin-master-detail-layout host default"] =

snapshots["vaadin-master-detail-layout host masterSize"] =
`<vaadin-master-detail-layout
expand="both"
expand="master"
orientation="horizontal"
overlay-containment="layout"
style="--_master-size: 300px;"
Expand All @@ -42,7 +42,7 @@ snapshots["vaadin-master-detail-layout host masterSize"] =

snapshots["vaadin-master-detail-layout host detailSize"] =
`<vaadin-master-detail-layout
expand="both"
expand="master"
orientation="horizontal"
overlay-containment="layout"
style="--_detail-size: 400px;"
Expand All @@ -62,7 +62,7 @@ snapshots["vaadin-master-detail-layout host detailSize"] =

snapshots["vaadin-master-detail-layout host masterSize and detailSize"] =
`<vaadin-master-detail-layout
expand="both"
expand="master"
orientation="horizontal"
overlay-containment="layout"
style="--_master-size: 300px; --_detail-size: 400px;"
Expand All @@ -82,7 +82,7 @@ snapshots["vaadin-master-detail-layout host masterSize and detailSize"] =

snapshots["vaadin-master-detail-layout host no detail"] =
`<vaadin-master-detail-layout
expand="both"
expand="master"
has-detail-placeholder=""
orientation="horizontal"
overlay-containment="layout"
Expand All @@ -99,7 +99,7 @@ snapshots["vaadin-master-detail-layout host no detail"] =

snapshots["vaadin-master-detail-layout host no detail placeholder"] =
`<vaadin-master-detail-layout
expand="both"
expand="master"
has-detail=""
orientation="horizontal"
overlay-containment="layout"
Expand Down Expand Up @@ -152,7 +152,7 @@ snapshots["vaadin-master-detail-layout shadow default"] =
snapshots["vaadin-master-detail-layout overlay mode default"] =
`<vaadin-master-detail-layout
detail-size="300px"
expand="both"
expand="master"
master-size="300px"
orientation="horizontal"
overlay-containment="layout"
Expand All @@ -168,7 +168,7 @@ snapshots["vaadin-master-detail-layout overlay mode default"] =
snapshots["vaadin-master-detail-layout overlay mode with detail"] =
`<vaadin-master-detail-layout
detail-size="300px"
expand="both"
expand="master"
has-detail=""
keep-detail-column-offscreen=""
master-size="300px"
Expand All @@ -190,7 +190,7 @@ snapshots["vaadin-master-detail-layout overlay mode with detail"] =
snapshots["vaadin-master-detail-layout overlay mode with detail placeholder"] =
`<vaadin-master-detail-layout
detail-size="300px"
expand="both"
expand="master"
has-detail-placeholder=""
master-size="300px"
orientation="horizontal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ describe('vaadin-master-detail-layout', () => {
});

describe('expand', () => {
it('should be set to both by default', () => {
expect(layout.expand).to.equal('both');
});

it('should reflect expand property to attribute', () => {
layout.expand = 'master';
expect(layout.getAttribute('expand')).to.equal('master');
it('should be set to master by default', () => {
expect(layout.expand).to.equal('master');
});
});

Expand Down
28 changes: 20 additions & 8 deletions packages/master-detail-layout/test/split-mode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ describe('split mode', () => {
await onceResized(layout);
});

describe('expand both (default)', () => {
describe('expand both', () => {
beforeEach(() => {
layout.expand = 'both';
Comment thread
web-padawan marked this conversation as resolved.
});

it('should expand both columns equally when both sizes are the same', async () => {
layout.masterSize = '200px';
layout.detailSize = '200px';
Expand Down Expand Up @@ -59,9 +63,8 @@ describe('split mode', () => {
});
});

describe('expand master', () => {
describe('expand master (default)', () => {
it('should fix detail and expand master to fill the rest', async () => {
layout.expand = 'master';
layout.masterSize = '100px';
layout.detailSize = '200px';
await onceResized(layout);
Expand All @@ -72,8 +75,11 @@ describe('split mode', () => {
});

describe('expand detail', () => {
it('should fix master and expand detail to fill the rest', async () => {
beforeEach(() => {
layout.expand = 'detail';
});

it('should fix master and expand detail to fill the rest', async () => {
layout.masterSize = '200px';
layout.detailSize = '100px';
await onceResized(layout);
Expand All @@ -97,7 +103,11 @@ describe('split mode', () => {
await onceResized(layout);
});

describe('expand both (default)', () => {
describe('expand both', () => {
beforeEach(() => {
layout.expand = 'both';
});

it('should expand both rows equally when both sizes are the same', async () => {
layout.masterSize = '200px';
layout.detailSize = '200px';
Expand All @@ -108,9 +118,8 @@ describe('split mode', () => {
});
});

describe('expand master', () => {
describe('expand master (default)', () => {
it('should fix detail and expand master to fill the rest', async () => {
layout.expand = 'master';
layout.masterSize = '100px';
layout.detailSize = '200px';
await onceResized(layout);
Expand All @@ -121,8 +130,11 @@ describe('split mode', () => {
});

describe('expand detail', () => {
it('should fix master and expand detail to fill the rest', async () => {
beforeEach(() => {
layout.expand = 'detail';
});

it('should fix master and expand detail to fill the rest', async () => {
layout.masterSize = '200px';
layout.detailSize = '100px';
await onceResized(layout);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ describe('master-detail-layout', () => {
await visualDiff(div, `${dir}-split-default`);
});

it('expand both', async () => {
mdl.expand = 'both';
await onceResized(mdl);
await visualDiff(div, `${dir}-split-expand-both`);
});

it('expand detail', async () => {
mdl.expand = 'detail';
await onceResized(mdl);
await visualDiff(div, `${dir}-split-expand-detail`);
});

it('dark', async () => {
document.documentElement.style.setProperty('color-scheme', 'dark');
await visualDiff(div, `${dir}-split-dark`);
Expand All @@ -82,6 +94,12 @@ describe('master-detail-layout', () => {
await visualDiff(document.body, `${dir}-overlay-viewport`);
});

it('overlay size', async () => {
mdl.overlaySize = '100%';
await onceResized(mdl);
await visualDiff(div, `${dir}-overlay-size`);
});

it('dark', async () => {
document.documentElement.style.setProperty('color-scheme', 'dark');
await visualDiff(div, `${dir}-overlay-dark`);
Expand All @@ -107,7 +125,6 @@ describe('master-detail-layout', () => {
});

it('default', async () => {
div.style.width = '800px';
await onceResized(mdl);
await visualDiff(div, 'detail-placeholder');
});
Expand All @@ -117,5 +134,17 @@ describe('master-detail-layout', () => {
await onceResized(mdl);
await visualDiff(div, 'detail-placeholder-overflow');
});

it('expand both', async () => {
mdl.expand = 'both';
await onceResized(mdl);
await visualDiff(div, `detail-placeholder-expand-both`);
});

it('expand detail', async () => {
mdl.expand = 'detail';
await onceResized(mdl);
await visualDiff(div, `detail-placeholder-expand-detail`);
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading