Skip to content

Commit

Permalink
rename class to className
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen authored and web-padawan committed Oct 10, 2023
1 parent 3c1ca63 commit 0cd9c77
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions packages/context-menu/src/vaadin-context-menu.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface ContextMenuEventMap extends HTMLElementEventMap, ContextMenuCus
*
* ```javascript
* contextMenu.items = [
* { text: 'Menu Item 1', theme: 'primary', class: 'first', children:
* { text: 'Menu Item 1', theme: 'primary', className: 'first', children:
* [
* { text: 'Menu Item 1-1', checked: true, keepOpen: true },
* { text: 'Menu Item 1-2' }
Expand All @@ -72,7 +72,7 @@ export interface ContextMenuEventMap extends HTMLElementEventMap, ContextMenuCus
* { text: 'Menu Item 2-2', disabled: true }
* ]
* },
* { text: 'Menu Item 3', disabled: true, class: 'last' }
* { text: 'Menu Item 3', disabled: true, className: 'last' }
* ];
*
* contextMenu.addEventListener('item-selected', e => {
Expand Down
4 changes: 2 additions & 2 deletions packages/context-menu/src/vaadin-context-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ContextMenuMixin } from './vaadin-context-menu-mixin.js';
*
* ```javascript
* contextMenu.items = [
* { text: 'Menu Item 1', theme: 'primary', class: 'first', children:
* { text: 'Menu Item 1', theme: 'primary', className: 'first', children:
* [
* { text: 'Menu Item 1-1', checked: true, keepOpen: true },
* { text: 'Menu Item 1-2' }
Expand All @@ -44,7 +44,7 @@ import { ContextMenuMixin } from './vaadin-context-menu-mixin.js';
* { text: 'Menu Item 2-2', disabled: true }
* ]
* },
* { text: 'Menu Item 3', disabled: true, class: 'last' }
* { text: 'Menu Item 3', disabled: true, className: 'last' }
* ];
*
* contextMenu.addEventListener('item-selected', e => {
Expand Down
6 changes: 3 additions & 3 deletions packages/context-menu/src/vaadin-contextmenu-items-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface ContextMenuItem {
checked?: boolean;
keepOpen?: boolean;
theme?: string[] | string;
class?: string;
className?: string;
children?: ContextMenuItem[];
}

Expand All @@ -32,7 +32,7 @@ export declare class ItemsMixinClass {
*
* ```javascript
* contextMenu.items = [
* { text: 'Menu Item 1', theme: 'primary', class: 'first', children:
* { text: 'Menu Item 1', theme: 'primary', className: 'first', children:
* [
* { text: 'Menu Item 1-1', checked: true, keepOpen: true },
* { text: 'Menu Item 1-2' }
Expand All @@ -45,7 +45,7 @@ export declare class ItemsMixinClass {
* { text: 'Menu Item 2-2', disabled: true }
* ]
* },
* { text: 'Menu Item 3', disabled: true, class: 'last' }
* { text: 'Menu Item 3', disabled: true, className: 'last' }
* ];
* ```
*/
Expand Down
10 changes: 5 additions & 5 deletions packages/context-menu/src/vaadin-contextmenu-items-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const ItemsMixin = (superClass) =>
* @property {boolean} disabled - If true, the item is disabled and cannot be selected
* @property {boolean} checked - If true, the item shows a checkmark next to it
* @property {boolean} keepOpen - If true, the menu will not be closed on item selection
* @property {string} class - A space-delimited list of CSS class names to be set on the menu item component.
* @property {string} className - A space-delimited list of CSS class names to be set on the menu item component.
* @property {union: string | string[]} theme - If set, sets the given theme(s) as an attribute to the menu item component, overriding any theme set on the context menu.
* @property {MenuItem[]} children - Array of child menu items
*/
Expand All @@ -37,7 +37,7 @@ export const ItemsMixin = (superClass) =>
*
* ```javascript
* contextMenu.items = [
* { text: 'Menu Item 1', theme: 'primary', class: 'first', children:
* { text: 'Menu Item 1', theme: 'primary', className: 'first', children:
* [
* { text: 'Menu Item 1-1', checked: true, keepOpen: true },
* { text: 'Menu Item 1-2' }
Expand All @@ -50,7 +50,7 @@ export const ItemsMixin = (superClass) =>
* { text: 'Menu Item 2-2', disabled: true }
* ]
* },
* { text: 'Menu Item 3', disabled: true, class: 'last' }
* { text: 'Menu Item 3', disabled: true, className: 'last' }
* ];
* ```
*
Expand Down Expand Up @@ -192,8 +192,8 @@ export const ItemsMixin = (superClass) =>
component.textContent = item.text;
}

if (item.class) {
component.setAttribute('class', item.class);
if (item.className) {
component.setAttribute('class', item.className);
}

this.__toggleMenuComponentAttribute(component, 'menu-item-checked', item.checked);
Expand Down
18 changes: 9 additions & 9 deletions packages/context-menu/test/dom/context-menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import '../../src/vaadin-context-menu.js';
import '../not-animated-styles.js';
import { openSubMenus } from '../helpers.js';

function createComponent(textContent, options) {
function createComponent(textContent, { className }) {
const component = document.createElement('div');
component.textContent = textContent;
component.setAttribute('class', options.class);
component.setAttribute('class', className);
return component;
}

Expand All @@ -21,27 +21,27 @@ describe('context-menu', () => {
};

const ITEMS = [
{ text: 'Menu Item 1', class: 'first' },
{ text: 'Menu Item 1', className: 'first' },
{ component: 'hr' },
{
text: 'Menu Item 2',
children: [
{ text: 'Menu Item 2-1', class: 'first' },
{ text: 'Menu Item 2-1', className: 'first' },
{
text: 'Menu Item 2-2',
class: 'last',
className: 'last',
children: [
{ text: 'Menu Item 2-2-1', checked: true, class: 'first' },
{ text: 'Menu Item 2-2-1', checked: true, className: 'first' },
{ text: 'Menu Item 2-2-2', disabled: true },
{ component: 'hr' },
{ text: 'Menu Item 2-2-3', class: 'last' },
{ text: 'Menu Item 2-2-3', className: 'last' },
],
},
],
},
{ text: 'Menu Item 3', disabled: true },
{ component: createComponent('Menu Item 4', { class: 'custom' }) },
{ component: createComponent('Menu Item 5', { class: 'custom' }), class: 'last' },
{ component: createComponent('Menu Item 4', { className: 'custom' }) },
{ component: createComponent('Menu Item 5', { className: 'custom' }), className: 'last' },
];

const contextmenu = (target) => {
Expand Down

0 comments on commit 0cd9c77

Please sign in to comment.