mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-18 05:59:42 +02:00
Merge 1abbf7a4d9 into ff975f1b9e
This commit is contained in:
commit
ba70820f58
|
|
@ -2533,8 +2533,8 @@
|
|||
"nodeSettings.communityNodeTooltip": "This is a <a href=\"{docUrl}\" target=\"_blank\"/>community node</a>",
|
||||
"nodeSettings.retryOnFail.description": "If active, the node tries to execute again when it fails",
|
||||
"nodeSettings.retryOnFail.displayName": "Retry On Fail",
|
||||
"nodeSettings.scopes.expandedNoticeWithScopes": "<a data-key=\"toggle-expand\">{count} scope</a> available for {activeCredential} credentials<br>{scopes}<br><a data-key=\"show-less\">Show less</a> | <a data-key=\"toggle-expand\">{count} scopes</a> available for {activeCredential} credentials<br>{scopes}<br><a data-key=\"show-less\">Show less</a>",
|
||||
"nodeSettings.scopes.notice": "<a data-key=\"toggle-expand\">{count} scope</a> available for {activeCredential} credentials | <a data-key=\"toggle-expand\">{count} scopes</a> available for {activeCredential} credentials",
|
||||
"nodeSettings.scopes.expandedNoticeWithScopes": "<a data-key=\"toggle-expand\">{count} scope available</a> for {activeCredential} credentials<br>{scopes}<br><a data-key=\"show-less\">Show less</a> | <a data-key=\"toggle-expand\">{count} scopes available</a> for {activeCredential} credentials<br>{scopes}<br><a data-key=\"show-less\">Show less</a>",
|
||||
"nodeSettings.scopes.notice": "<a data-key=\"toggle-expand\">{count} scope available</a> for {activeCredential} credentials | <a data-key=\"toggle-expand\">{count} scopes available</a> for {activeCredential} credentials",
|
||||
"nodeSettings.theNodeIsNotValidAsItsTypeIsUnknown": "The node is not valid as its type ({nodeType}) is unknown",
|
||||
"nodeSettings.communityNodeDetails.title": "Node details",
|
||||
"nodeSettings.communityNodeUnknown.title": "Install this node to use it",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
import { createTestingPinia } from '@pinia/testing';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import { createComponentRenderer } from '@/__tests__/render';
|
||||
import { useCredentialsStore } from '../credentials.store';
|
||||
import ScopesNotice from './ScopesNotice.vue';
|
||||
|
||||
const renderComponent = createComponentRenderer(ScopesNotice);
|
||||
|
||||
describe.each([
|
||||
{ scopeCount: '1 scope', scopes: ['read:items'] },
|
||||
{ scopeCount: '2 scopes', scopes: ['read:items', 'write:items'] },
|
||||
])('ScopesNotice ($scopeCount)', ({ scopeCount, scopes }) => {
|
||||
beforeEach(() => {
|
||||
createTestingPinia();
|
||||
useCredentialsStore().state.credentialTypes = {
|
||||
testOAuth2Api: {
|
||||
name: 'testOAuth2Api',
|
||||
displayName: 'Test OAuth2 API',
|
||||
properties: [],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
it('reveals the available scopes when clicking the scope count', async () => {
|
||||
const { getByText, getByRole } = renderComponent({
|
||||
props: {
|
||||
activeCredentialType: 'testOAuth2Api',
|
||||
scopes,
|
||||
},
|
||||
});
|
||||
|
||||
expect(getByRole('region')).not.toHaveTextContent('read:items');
|
||||
expect(getByRole('region')).not.toHaveTextContent('write:items');
|
||||
|
||||
await userEvent.click(getByText(scopeCount, { exact: false }));
|
||||
|
||||
for (const scope of scopes) {
|
||||
expect(getByRole('region')).toHaveTextContent(scope);
|
||||
}
|
||||
expect(getByText('Show less')).toBeVisible();
|
||||
|
||||
await userEvent.click(getByText('Show less'));
|
||||
|
||||
for (const scope of scopes) {
|
||||
expect(getByRole('region')).not.toHaveTextContent(scope);
|
||||
}
|
||||
expect(getByText(`${scopeCount} available`)).toBeVisible();
|
||||
});
|
||||
|
||||
// NODE-5622: Users expect the "scopes available" control to reveal the scope list.
|
||||
it('reveals the available scopes when clicking the available label', async () => {
|
||||
const { getByText, getByRole } = renderComponent({
|
||||
props: {
|
||||
activeCredentialType: 'testOAuth2Api',
|
||||
scopes,
|
||||
},
|
||||
});
|
||||
|
||||
expect(getByRole('region')).not.toHaveTextContent('read:items');
|
||||
expect(getByRole('region')).not.toHaveTextContent('write:items');
|
||||
|
||||
await userEvent.click(getByText(/available/));
|
||||
|
||||
for (const scope of scopes) {
|
||||
expect(getByRole('region')).toHaveTextContent(scope);
|
||||
}
|
||||
expect(getByText('Show less')).toBeVisible();
|
||||
|
||||
await userEvent.click(getByText(/available/));
|
||||
|
||||
for (const scope of scopes) {
|
||||
expect(getByRole('region')).not.toHaveTextContent(scope);
|
||||
}
|
||||
expect(getByText(`${scopeCount} available`)).toBeVisible();
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user