diff --git a/packages/iobroker.vis-2/src-vis/src/Toolbar/MultiSelect.tsx b/packages/iobroker.vis-2/src-vis/src/Toolbar/MultiSelect.tsx index 1c8a88c5..84308599 100644 --- a/packages/iobroker.vis-2/src-vis/src/Toolbar/MultiSelect.tsx +++ b/packages/iobroker.vis-2/src-vis/src/Toolbar/MultiSelect.tsx @@ -87,6 +87,7 @@ interface MultiSelectProps { setSelectedWidgets: (widgets: string[]) => void; themeType: ThemeType; theme: VisTheme; + id?: string; } interface MultiSelectState { @@ -105,10 +106,10 @@ class MultiSelect extends Component { const props = this.props; const value = props.value || []; - let text; - let subText = null; + let text: string | React.JSX.Element; + let subText: string | null = null; let color: string; - let icon; + let icon: React.JSX.Element | undefined; if (value.length === 1) { const item = props.options.find(foundItem => foundItem.value === value[0]); if (item) { @@ -128,6 +129,9 @@ class MultiSelect extends Component { } else { text = value.join(', '); } + if (props.id) { + text = {text}; + } let backColor; if (color) { diff --git a/packages/iobroker.vis-2/src-vis/src/Toolbar/ToolbarItems.tsx b/packages/iobroker.vis-2/src-vis/src/Toolbar/ToolbarItems.tsx index f0d329c9..0f3b0caf 100644 --- a/packages/iobroker.vis-2/src-vis/src/Toolbar/ToolbarItems.tsx +++ b/packages/iobroker.vis-2/src-vis/src/Toolbar/ToolbarItems.tsx @@ -83,6 +83,7 @@ export interface MultiselectToolbarItem extends BaseToolbarItem { width: number; value?: string[]; onAction: (value: string[]) => void; + id?: string; } export interface CheckboxToolbarItem extends BaseToolbarItem { @@ -218,6 +219,7 @@ class ToolbarItems extends React.Component theme={this.props.theme} key={key} // style={{ margin: '0px 10px' }} + id={item.id} label={ this.props.toolbarHeight !== 'veryNarrow' ? item.doNotTranslateName diff --git a/packages/iobroker.vis-2/src-vis/src/Toolbar/Widgets.tsx b/packages/iobroker.vis-2/src-vis/src/Toolbar/Widgets.tsx index b826d2e3..a745061d 100644 --- a/packages/iobroker.vis-2/src-vis/src/Toolbar/Widgets.tsx +++ b/packages/iobroker.vis-2/src-vis/src/Toolbar/Widgets.tsx @@ -106,6 +106,7 @@ const Widgets: React.FC = props => { type: 'multiselect', name: I18n.t('Active widget(s) from %s', shownWidgets.length), doNotTranslateName: true, + id: 'tests-vis-selected-widget', items: shownWidgets.map((widgetId: AnyWidgetId) => { const tpl = widgets[widgetId].tpl; const widgetType = widgetTypes.find(w => w.name === tpl);