Skip to content

Commit

Permalink
test(plasma-web): Radiobox: check only for id existance
Browse files Browse the repository at this point in the history
  • Loading branch information
fanisco committed Mar 30, 2022
1 parent b0a9c6b commit 87336eb
Show file tree
Hide file tree
Showing 25 changed files with 100 additions and 15 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,9 @@ describe('plasma-core: Radiobox', () => {
mount(
<CypressTestDecorator noSSR>
<Radiobox name="uniqId" label="radiobox" description="О чём мечтают роботы?" />
<Radiobox name="robots" id="radio" label="radiobox" description="О чём мечтают роботы?" />
</CypressTestDecorator>,
);

cy.get('#radio').then((el) => {
cy.get(`#${el.attr('aria-labelledby')}`).should('contain', 'radiobox');

cy.get(`#${el.attr('aria-describedby')}`).should('contain', 'О чём мечтают роботы');
});

cy.get('[name="uniqId"]').then((el) => {
cy.get(`#${el.attr('aria-labelledby')}`).should('contain', 'radiobox');

cy.get(`#${el.attr('aria-describedby')}`).should('contain', 'О чём мечтают роботы');
});

cy.get('[name="uniqId"]').should('have.attr', 'id');
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React from 'react';
import { mount, CypressTestDecorator, getComponent } from '@sberdevices/plasma-cy-utils';

describe('plasma-web: Checkbox', () => {
const Checkbox = getComponent('Checkbox');
const Link = getComponent('Link');
const List = getComponent('List');
const ListItem = getComponent('ListItem');
const name = 'languages';
const items = [
{
name,
value: 'natural',
label: 'Естественные языки',
disabled: false,
checked: true,
indeterminate: false,
description: 'Языки, на которых говорят люди. Они не были созданы искуственно и развивались естественно.',
},
{ name, value: 'russian', label: 'Русский', checked: true, disabled: false, parent: 'natural' },
{
name,
value: 'english',
label: 'Английский',
checked: true,
disabled: false,
description: (
<>
Самый распространенный язык в <Link href="/#">мире</Link>
</>
),
parent: 'natural',
},
{ name, value: 'french', label: 'Французский', checked: true, disabled: false, parent: 'natural' },
{
name,
value: 'chinese',
label: (
<>
Китайский <Link href="/#">язык</Link>
</>
),
checked: true,
parent: 'natural',
},
{
name,
value: 'artificial',
label: 'Искусственные языки',
checked: false,
indeterminate: true,
disabled: false,
},
{
name,
value: 'klingon',
label: 'Клингонский',
disabled: false,
checked: false,
description: 'Язык одной из раз в сериале СтарТрек',
parent: 'artificial',
},
{
name,
value: 'elvish',
label: 'Эльфийский',
disabled: true,
checked: true,
description: 'Искусственный язык из вселенной Властелина колец',
parent: 'artificial',
},
{
name,
value: 'dothraki',
label: 'Дотракийский',
disabled: true,
checked: false,
description: 'Язык, разработанный для реплик дотракийских племен из вселенной Песнь Льда и Огня',
parent: 'artificial',
},
];

it('default', () => {
mount(
<CypressTestDecorator>
<List>
{items.map((item) => (
<ListItem key={item.value} ml={item.parent ? '16x' : undefined} mb="4x">
<Checkbox {...item} />
</ListItem>
))}
</List>
</CypressTestDecorator>,
);

cy.get('input[type="checkbox"]').first().focus();
cy.matchImageSnapshot();
});
});

This file was deleted.

0 comments on commit 87336eb

Please sign in to comment.