@elastic/eui
Version:
Elastic UI Component Library
76 lines (74 loc) • 2.19 kB
JavaScript
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
/// <reference types="cypress" />
/// <reference types="cypress-real-events" />
/// <reference types="../../../cypress/support" />
import React from 'react';
import { EuiTreeView } from './tree_view';
import { jsx as ___EmotionJSX } from "@emotion/react";
var TreeView = function TreeView() {
var items = [{
label: 'Item One',
id: 'item_one',
isExpanded: true,
children: [{
label: 'Item A',
id: 'item_a'
}, {
label: 'Item B',
id: 'item_b',
children: [{
label: 'A Cloud',
id: 'item_cloud'
}, {
label: "I'm a Bug",
id: 'item_bug',
className: 'classForBug'
}]
}, {
label: 'Item C',
id: 'item_c',
children: [{
label: 'Another Cloud',
id: 'item_cloud2'
}, {
label: 'Another Bug',
id: 'item_bug2'
}]
}]
}, {
label: 'Item Two',
id: 'item_two'
}];
var defaultTreeViewProps = {
items: items,
'aria-label': 'Sample folder tree'
};
return ___EmotionJSX("div", {
style: {
width: '20rem'
}
}, ___EmotionJSX(EuiTreeView, defaultTreeViewProps));
};
describe('EuiTreeView', function () {
describe('Automated accessibility check', function () {
it('has zero violations on first render', function () {
cy.mount(___EmotionJSX(TreeView, null));
cy.get('ul.euiTreeView').should('exist');
cy.checkAxe();
});
it('has zero violations with a nested child expanded', function () {
cy.mount(___EmotionJSX(TreeView, null));
cy.get('ul.euiTreeView').should('exist');
cy.get('button#item_b').realClick();
cy.get('button#item_b').should('have.attr', 'aria-expanded', 'true');
cy.get('li.euiTreeView__node').contains('A Cloud').should('exist');
cy.checkAxe();
});
});
});