Skip to content

Commit

Permalink
feat: migrate to generic construction
Browse files Browse the repository at this point in the history
  • Loading branch information
mathuo committed Dec 23, 2024
1 parent f6e7e4e commit 1ab4371
Show file tree
Hide file tree
Showing 23 changed files with 566 additions and 593 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
className: 'test-a test-b',
});

Expand All @@ -51,7 +53,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand All @@ -70,7 +74,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -100,7 +106,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -160,7 +168,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -287,7 +297,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(1000, 1000);
Expand Down Expand Up @@ -323,7 +335,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -446,7 +460,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -475,7 +491,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -533,7 +551,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -591,7 +611,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -667,7 +689,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -761,7 +785,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -855,7 +881,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -949,7 +977,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -1073,7 +1103,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -1197,7 +1229,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -1323,7 +1357,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -1447,7 +1483,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(800, 400);
Expand Down Expand Up @@ -1571,7 +1609,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.fromJSON({
Expand Down Expand Up @@ -1698,7 +1738,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(1000, 1000);
Expand Down Expand Up @@ -1728,7 +1770,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});
gridview.layout(1000, 1000);

Expand Down Expand Up @@ -1757,7 +1801,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: false,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});
gridview.layout(1000, 1000);

Expand Down Expand Up @@ -1795,7 +1841,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

let addGroup: GridviewPanel[] = [];
Expand Down Expand Up @@ -1917,7 +1965,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(1600, 800);
Expand Down Expand Up @@ -2043,7 +2093,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(6000, 5000);
Expand Down Expand Up @@ -2318,7 +2370,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.VERTICAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

gridview.layout(5000, 6000);
Expand Down Expand Up @@ -2591,7 +2645,14 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
switch (options.name) {
case 'default':
return new TestGridview(options.id, options.name);
default:
throw new Error(`unsupported panel '${options.name}'`);
}
},
});

let el = gridview.element.querySelector('.dv-view-container');
Expand Down Expand Up @@ -2655,9 +2716,7 @@ describe('gridview', () => {
},
activePanel: 'panel_1',
});
}).toThrow(
"Cannot create 'panel_1', no component 'somethingBad' provided"
);
}).toThrow("unsupported panel 'somethingBad'");

expect(gridview.groups.length).toBe(0);

Expand All @@ -2670,7 +2729,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
});

expect(gridview.disableResizing).toBeFalsy();
Expand All @@ -2680,7 +2741,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
disableAutoResizing: true,
});

Expand All @@ -2691,7 +2754,9 @@ describe('gridview', () => {
const gridview = new GridviewComponent(container, {
proportionalLayout: true,
orientation: Orientation.HORIZONTAL,
components: { default: TestGridview },
createComponent: (options) => {
return new TestGridview(options.id, options.name);
},
disableAutoResizing: true,
});
gridview.layout(1000, 1000);
Expand Down
Loading

0 comments on commit 1ab4371

Please sign in to comment.