Skip to content

Commit

Permalink
fix(picker-column): cssClass is set on column (#26658)
Browse files Browse the repository at this point in the history
resolves #26653
  • Loading branch information
liamdebeasi authored Jan 23, 2023
1 parent 1115203 commit c6620c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/components/picker-column/picker-column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getIonMode } from '../../global/ionic-global';
import type { Gesture, GestureDetail, PickerColumn } from '../../interface';
import { clamp } from '../../utils/helpers';
import { hapticSelectionChanged, hapticSelectionEnd, hapticSelectionStart } from '../../utils/native/haptic';
import { getClassMap } from '../../utils/theme';

/**
* @internal
Expand Down Expand Up @@ -368,6 +369,7 @@ export class PickerColumnCmp implements ComponentInterface {
'picker-col': true,
'picker-opts-left': this.col.align === 'left',
'picker-opts-right': this.col.align === 'right',
...getClassMap(col.cssClass),
}}
style={{
'max-width': this.col.columnWidth,
Expand Down
17 changes: 17 additions & 0 deletions core/src/components/picker-column/test/picker-column.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { h } from '@stencil/core';
import { newSpecPage } from '@stencil/core/testing';
import { PickerColumnCmp } from '../picker-column';

describe('picker-column', () => {
it('should add class to host of component', async () => {
const col = { cssClass: 'test-class', options: [] };

const page = await newSpecPage({
components: [PickerColumnCmp],
template: () => <ion-picker-column col={col}></ion-picker-column>,
});

const pickerCol = page.body.querySelector('ion-picker-column');
expect(pickerCol.classList.contains('test-class')).toBe(true);
});
});

0 comments on commit c6620c7

Please sign in to comment.