Merge pull request #6869 from vinzscam/copy-text-button-clipboard-api
copy-text-button: remove hidden textarea
This commit is contained in:
@@ -111,7 +111,7 @@ paths:
|
||||
},
|
||||
};
|
||||
|
||||
const { getByText } = await renderInTestApp(
|
||||
const { getByText, getAllByText } = await renderInTestApp(
|
||||
<Wrapper>
|
||||
<EntityProvider entity={apiEntity}>
|
||||
<ApiDefinitionCard />
|
||||
@@ -121,6 +121,10 @@ paths:
|
||||
|
||||
expect(getByText(/my-name/i)).toBeInTheDocument();
|
||||
expect(getByText(/custom-type/i)).toBeInTheDocument();
|
||||
expect(getByText(/Custom Definition/i)).toBeInTheDocument();
|
||||
expect(
|
||||
getAllByText(
|
||||
(_text, element) => element?.textContent === 'Custom Definition',
|
||||
).length,
|
||||
).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
+6
-2
@@ -20,9 +20,13 @@ import { PlainApiDefinitionWidget } from './PlainApiDefinitionWidget';
|
||||
|
||||
describe('<PlainApiDefinitionWidget />', () => {
|
||||
it('renders plain text', async () => {
|
||||
const { getByText } = await renderInTestApp(
|
||||
const { getAllByText } = await renderInTestApp(
|
||||
<PlainApiDefinitionWidget definition="Hello World" language="yaml" />,
|
||||
);
|
||||
expect(getByText(/Hello World/i)).toBeInTheDocument();
|
||||
|
||||
expect(
|
||||
getAllByText((_text, element) => element?.textContent === 'Hello World')
|
||||
.length,
|
||||
).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user