Skip to content

Commit 5c61571

Browse files
committed
checkpoint: refactor key bindings and others
1 parent f6474e2 commit 5c61571

File tree

4 files changed

+207
-189
lines changed

4 files changed

+207
-189
lines changed

src/components/splitter/splitter.spec.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ describe('Splitter', () => {
6161

6262
it('should render splitter bar between start and end parts', async () => {
6363
const base = getSplitterPart(splitter, 'base');
64-
const startPart = getSplitterPart(splitter, 'startPane');
65-
const endPart = getSplitterPart(splitter, 'endPane');
64+
const startPart = getSplitterPart(splitter, 'start-pane');
65+
const endPart = getSplitterPart(splitter, 'end-pane');
6666
const bar = getSplitterPart(splitter, 'bar');
6767

6868
expect(base).to.exist;
@@ -80,9 +80,9 @@ describe('Splitter', () => {
8080

8181
it('should render splitter bar parts', async () => {
8282
const bar = getSplitterPart(splitter, 'bar');
83-
const expanderStart = getSplitterPart(splitter, 'expander-start');
83+
const expanderStart = getSplitterPart(splitter, 'start-expander');
8484
const barHandle = getSplitterPart(splitter, 'handle');
85-
const expanderEnd = getSplitterPart(splitter, 'expander-end');
85+
const expanderEnd = getSplitterPart(splitter, 'end-expander');
8686

8787
expect(expanderStart).to.exist;
8888
expect(barHandle).to.exist;
@@ -216,7 +216,7 @@ describe('Splitter', () => {
216216
splitter.startSize = '200px';
217217
await elementUpdated(splitter);
218218

219-
const startPart = getSplitterPart(splitter, 'startPane');
219+
const startPart = getSplitterPart(splitter, 'start-pane');
220220
const style = getComputedStyle(startPart);
221221
expect(style.flex).to.equal('0 0 200px');
222222

@@ -231,7 +231,7 @@ describe('Splitter', () => {
231231
it('should properly set default min/max values when not specified', async () => {
232232
await elementUpdated(splitter);
233233

234-
const startPart = getSplitterPart(splitter, 'startPane');
234+
const startPart = getSplitterPart(splitter, 'start-pane');
235235
const style = getComputedStyle(startPart);
236236
expect(style.flex).to.equal('1 1 auto');
237237

@@ -256,7 +256,7 @@ describe('Splitter', () => {
256256

257257
await elementUpdated(splitter);
258258

259-
const startPane = getSplitterPart(splitter, 'startPane');
259+
const startPane = getSplitterPart(splitter, 'start-pane');
260260
const style = getComputedStyle(startPane);
261261
expect(style.minWidth).to.equal('100px');
262262
expect(style.maxWidth).to.equal('500px');
@@ -272,7 +272,7 @@ describe('Splitter', () => {
272272
);
273273
await elementUpdated(splitter);
274274

275-
const startPane = getSplitterPart(splitter, 'startPane');
275+
const startPane = getSplitterPart(splitter, 'start-pane');
276276
const style = getComputedStyle(startPane);
277277
expect(style.minHeight).to.equal('100px');
278278
expect(style.maxHeight).to.equal('500px');
@@ -289,10 +289,10 @@ describe('Splitter', () => {
289289
);
290290
await elementUpdated(splitter);
291291

292-
const startPane = getSplitterPart(splitter, 'startPane');
292+
const startPane = getSplitterPart(splitter, 'start-pane');
293293
const style1 = getComputedStyle(startPane);
294294

295-
const endPane = getSplitterPart(splitter, 'endPane');
295+
const endPane = getSplitterPart(splitter, 'end-pane');
296296
const style2 = getComputedStyle(endPane);
297297

298298
expect(splitter.startSize).to.equal('30%');
@@ -317,7 +317,7 @@ describe('Splitter', () => {
317317
);
318318
await elementUpdated(mixedConstraintSplitter);
319319

320-
const startPane = getSplitterPart(mixedConstraintSplitter, 'startPane');
320+
const startPane = getSplitterPart(mixedConstraintSplitter, 'start-pane');
321321
const style = getComputedStyle(startPane);
322322

323323
expect(mixedConstraintSplitter.startMinSize).to.equal('100px');
@@ -351,8 +351,8 @@ describe('Splitter', () => {
351351
});
352352

353353
it('should toggle the next pane when the bar expander-end is clicked', async () => {
354-
const expanderStart = getSplitterPart(splitter, 'expander-start');
355-
const expanderEnd = getSplitterPart(splitter, 'expander-end');
354+
const expanderStart = getSplitterPart(splitter, 'start-expander');
355+
const expanderEnd = getSplitterPart(splitter, 'end-expander');
356356

357357
simulatePointerDown(expanderEnd, { bubbles: true });
358358
await elementUpdated(splitter);
@@ -363,7 +363,7 @@ describe('Splitter', () => {
363363
expect(expanderStart.hidden).to.be.false;
364364
expect(expanderEnd.hidden).to.be.true;
365365

366-
simulatePointerDown(expanderEnd, { bubbles: true });
366+
simulatePointerDown(expanderStart, { bubbles: true });
367367
await elementUpdated(splitter);
368368
await nextFrame();
369369

@@ -374,8 +374,8 @@ describe('Splitter', () => {
374374
});
375375

376376
it('should toggle the previous pane when the bar expander-start is clicked', async () => {
377-
const expanderStart = getSplitterPart(splitter, 'expander-start');
378-
const expanderEnd = getSplitterPart(splitter, 'expander-end');
377+
const expanderStart = getSplitterPart(splitter, 'start-expander');
378+
const expanderEnd = getSplitterPart(splitter, 'end-expander');
379379

380380
simulatePointerDown(expanderStart, { bubbles: true });
381381
await elementUpdated(splitter);
@@ -386,7 +386,7 @@ describe('Splitter', () => {
386386
expect(expanderStart.hidden).to.be.true;
387387
expect(expanderEnd.hidden).to.be.false;
388388

389-
simulatePointerDown(expanderStart, { bubbles: true });
389+
simulatePointerDown(expanderEnd, { bubbles: true });
390390
await elementUpdated(splitter);
391391
await nextFrame();
392392

@@ -601,8 +601,8 @@ describe('Splitter', () => {
601601
await elementUpdated(splitter);
602602

603603
let currentSizes = getPanesSizes(splitter, 'width');
604-
const splitterSize = splitter.getBoundingClientRect()['width'];
605-
const barSize = bar.getBoundingClientRect()['width'];
604+
const splitterSize = splitter.getBoundingClientRect().width;
605+
const barSize = bar.getBoundingClientRect().width;
606606

607607
expect(currentSizes.startSize).to.equal(0);
608608
expect(currentSizes.endSize).to.equal(splitterSize - barSize);
@@ -656,8 +656,8 @@ describe('Splitter', () => {
656656
await elementUpdated(splitter);
657657

658658
let currentSizes = getPanesSizes(splitter, 'height');
659-
const splitterSize = splitter.getBoundingClientRect()['height'];
660-
const barSize = bar.getBoundingClientRect()['height'];
659+
const splitterSize = splitter.getBoundingClientRect().height;
660+
const barSize = bar.getBoundingClientRect().height;
661661

662662
expect(currentSizes.startSize).to.equal(0);
663663
expect(currentSizes.endSize).to.equal(splitterSize - barSize);
@@ -855,12 +855,12 @@ function getSplitterSlot(
855855

856856
// TODO: more parts and names?
857857
type SplitterParts =
858-
| 'startPane'
859-
| 'endPane'
858+
| 'start-pane'
859+
| 'end-pane'
860860
| 'bar'
861861
| 'base'
862-
| 'expander-start'
863-
| 'expander-end'
862+
| 'start-expander'
863+
| 'end-expander'
864864
| 'handle';
865865

866866
function getSplitterPart(splitter: IgcSplitterComponent, which: SplitterParts) {
@@ -902,8 +902,8 @@ function getPanesSizes(
902902
splitter: IgcSplitterComponent,
903903
dimension: 'width' | 'height' = 'width'
904904
) {
905-
const startPane = getSplitterPart(splitter, 'startPane');
906-
const endPane = getSplitterPart(splitter, 'endPane');
905+
const startPane = getSplitterPart(splitter, 'start-pane');
906+
const endPane = getSplitterPart(splitter, 'end-pane');
907907

908908
return {
909909
startSize: roundPrecise(startPane.getBoundingClientRect()[dimension]),

0 commit comments

Comments
 (0)