Skip to content

Commit

Permalink
fix(select): remove useless comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dpellier committed Aug 10, 2023
1 parent 742d2b1 commit bc14cb9
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,6 @@ describe('spec:osds-select-option', () => {
});

describe('attributes', () => {

// function getAttributeContextOptions<Name extends keyof OdsSelectOptionAttributes = keyof OdsSelectOptionAttributes>({
// name,
// list,
// defaultValue
// }: odsGetUnitTestAttributeContextOptions<OdsSelectOptionAttributes, Name>) {
// return odsGetUnitTestAttributeBaseOptions<OdsSelectOptionAttributes, Name, OsdsSelectOption>({
// name,
// list,
// defaultValue,
// instance: () => instance,
// root: () => page.root,
// wait: () => page.waitForChanges(),
// setup: (value) => {
// const attributes: Partial<OdsSelectOptionAttributes> = {};
// attributes[ name ] = value;
// return setup({ attributes });
// },
// })
// }
const config = {
instance: () => instance,
page: () => page,
Expand All @@ -79,13 +59,6 @@ describe('spec:osds-select-option', () => {
};

describe('value', () => {
// odsUnitTestAttribute<OdsSelectOptionAttribute, 'value'>({
// ...getAttributeContextOptions({
// name: 'value',
// list: [3, 4],
// defaultValue: DEFAULT_ATTRIBUTE.value,
// })
// });
odsUnitTestAttribute<OdsSelectOptionAttribute, 'value'>({
name: 'value',
defaultValue: DEFAULT_ATTRIBUTE.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ describe('spec:ods-select-controller', () => {
controller.selectOptions = [item1, item2];
}

beforeEach(() => {
// component = new OdsSelectMock();
// item1 = document.createElement('osds-select-option') as OdsSelectOption & HTMLElement;
// item1.value = '1';
// item2 = document.createElement('osds-select-option') as OdsSelectOption & HTMLElement;
// item2.value = '2';
// component.el = document.createElement('osds-select');
// component.el.appendChild(item1);
// component.el.appendChild(item2);
});

it('should initialize', () => {
setup();
expect(controller).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class OdsSelectController {
}

handlerKeyDown(event: KeyboardEvent): void {
console.log(this.selectOptions)
const selectedSelectOptionIndex = this.selectOptions.findIndex((select) => select.getAttribute('selected') !== null || document.activeElement === select);
switch (event.code) {
case 'Escape': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,31 @@ interface OdsSelectAttribute {
* The id to an external description
*/
ariaLabelledby: string;
/** the primary color of the theme */
color: OdsThemeColorIntent;
/**
* indicates if a value has to be selected
* Its corresponding default value. It needs to match with one option so the option will be selected
*/
required: boolean;
defaultValue: OdsInputValue;
/**
* indicates if the select is entirely disabled.
* it means no interactions (hover, click, focus, etc)
*/
disabled: boolean;
/** full width or not: see component principles */
inline: boolean;
/** opened or not */
opened?: boolean;
/**
* Its corresponding default value. It needs to match with one option so the option will be selected
* indicates if a value has to be selected
*/
defaultValue: OdsInputValue;
required: boolean;
/** size: see component principles */
size: ODS_SELECT_SIZE;
/**
* Its corresponding value. It needs to correspond to the value of the option
*/
value: OdsInputValue;
/** full width or not: see component principles */
inline: boolean;
/** size: see component principles */
size: ODS_SELECT_SIZE;
/*
* color of the select input and his icon arrow.
* color is not yet customizable trough his attribute.
* for now, it is forced to primary color (internally)
* @experimental
*/
/** the primary color of the theme */
color: OdsThemeColorIntent;
/** opened or not */
opened?: boolean;
}

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type { EventEmitter } from '@stencil/core';
import type { OsdsSelectOption } from '../../osds-select-option/osds-select-option';

interface OdsSelectValueChangeEventDetail {
value: OdsInputValue,
oldValue?: OdsInputValue,
validity: OdsValidityState,
selection: OsdsSelectOption | null,
validity: OdsValidityState,
value: OdsInputValue,
}

type OdsSelectValueChangeEvent = CustomEvent<OdsSelectValueChangeEventDetail>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@ import type { OdsValidityState } from '@ovhcloud/ods-common-core';

interface OdsSelectMethod {
/**
* reset the value to the initial one (default value)
* erase the current selection
*/
reset(): Promise<void>;
clear(): Promise<void>;

/**
* erase the current selection
* get the validity state
*/
clear(): Promise<void>;
getValidity(): Promise<OdsValidityState>;

/**
* check that the select is valid or not.
* In case of required field, the validation will check the entered value
* and set the field in error if it is not fulfilled
* reset the value to the initial one (default value)
*/
validate(): Promise<OdsValidityState>;
reset(): Promise<void>;

/**
* focus the element
Expand All @@ -29,9 +27,11 @@ interface OdsSelectMethod {
setInputTabindex(value: number): Promise<void>;

/**
* get the validity state
* check that the select is valid or not.
* In case of required field, the validation will check the entered value
* and set the field in error if it is not fulfilled
*/
getValidity(): Promise<OdsValidityState>;
validate(): Promise<OdsValidityState>;
}

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,6 @@ describe('spec:osds-select', () => {
})

describe('attributes', () => {

// function getAttributeContextOptions<Name extends keyof OdsSelectAttributes = keyof OdsSelectAttributes>({
// name,
// list,
// defaultValue
// }: odsGetUnitTestAttributeContextOptions<OdsSelectAttributes, Name>) {
// return odsGetUnitTestAttributeBaseOptions<OdsSelectAttributes, Name, OsdsSelect>({
// name,
// list,
// defaultValue,
// instance: () => instance,
// root: () => page.root,
// wait: () => page.waitForChanges(),
// setup: (value) => {
// const attributes: Partial<OdsSelectAttributes> = {};
// attributes[ name ] = value;
// return setup({ attributes });
// },
// })
// }
const config = {
instance: () => instance,
page: () => page,
Expand Down

0 comments on commit bc14cb9

Please sign in to comment.