This commit is contained in:
n8n-cat-bot[bot] 2026-10-17 15:58:33 +00:00 committed by GitHub
commit ba70820f58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 79 additions and 2 deletions

View File

@ -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",

View File

@ -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();
});
});