From 69ed3ce08edd32638ec858f59e6c09790b8c0281 Mon Sep 17 00:00:00 2001 From: aagash-ni <123377167+aagash-ni@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:50:39 +0530 Subject: [PATCH 1/4] Re-enable mention intermittent failed cases (#2403) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request ## ๐Ÿคจ Rationale **Issue**: [#2219](https://github.com/ni/nimble/issues/2219) We are re-enabling tests that were previously disabled due to intermittent failures and disabling only in the Firefox environment, as the issue occurred only once during four days of testing. Additionally, there were other cases that are validating the same mention workflow, which has been successfully running in Firefox. After conducting tests in a loop environment on GitHub agents, the tests did not fail with the same error. Please refer to the bug discussion for all the pipeline checks: [Bug 2787273](https://dev.azure.com/ni/DevCentral/_workitems/edit/2787273) - Intermittent failures in the Rich Text Editor for Mention support. Following this, we will monitor for any related failures and have created a [TD](https://github.com/ni/nimble/issues/2404) to track the skipped Firefox browser tests. ## ๐Ÿ‘ฉโ€๐Ÿ’ป Implementation Re-enabled the disabled test case. Update: 1. For test `should show mention popup for multiple mention configuration elements`: 1. Instead of committing the `@` mention node, remove the `@` and add `!` to verify other mention type list options and popup visibility. 2. The test can now verify the list options for multiple mentions by opening the popup. 1. For test `Serialize rich text editor content to its respective markdown Mention node`: 1. Update the `clickMentionListboxOption` to focus on the editor before committing the mention from the list options. 1. Update other methods that modify the content of the editor to also receive focus to the editor to ensure any other intermittencies. 1. Update the `isMentionListboxOpened` method to read from the `hidden` property and also wait before reading to resolve the intermittent failures on Firefox when running in loop. See the discussion below for more details, https://github.com/ni/nimble/pull/2403#discussion_r1767401349 ## ๐Ÿงช Testing NA ## โœ… Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Vivin Krishna <123377523+vivinkrishna-ni@users.noreply.github.com> --- ...-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json | 7 ++ .../testing/rich-text-editor.pageobject.ts | 38 +++++--- .../tests/rich-text-editor-mention.spec.ts | 93 ++++++++++--------- .../editor/tests/rich-text-editor.spec.ts | 37 ++++---- .../models/tests/markdown-serializer.spec.ts | 5 +- 5 files changed, 106 insertions(+), 74 deletions(-) create mode 100644 change/@ni-nimble-components-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json diff --git a/change/@ni-nimble-components-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json b/change/@ni-nimble-components-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json new file mode 100644 index 0000000000..a6d6481be6 --- /dev/null +++ b/change/@ni-nimble-components-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Re-enable mention intermittently failed test cases", + "packageName": "@ni/nimble-components", + "email": "123377167+aagash-ni@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/nimble-components/src/rich-text/editor/testing/rich-text-editor.pageobject.ts b/packages/nimble-components/src/rich-text/editor/testing/rich-text-editor.pageobject.ts index 1863bd4b87..8f680dc1f1 100644 --- a/packages/nimble-components/src/rich-text/editor/testing/rich-text-editor.pageobject.ts +++ b/packages/nimble-components/src/rich-text/editor/testing/rich-text-editor.pageobject.ts @@ -216,25 +216,29 @@ export class RichTextEditorPageObject { toggleButton.control.dispatchEvent(event); } - public pasteToEditor(text: string): void { + public async pasteToEditor(text: string): Promise { const editor = this.getTiptapEditor(); const pasteEvent = new ClipboardEvent('paste', { clipboardData: new DataTransfer() }); pasteEvent.clipboardData?.setData('text/plain', text); editor.dispatchEvent(pasteEvent); + + await this.focusEditorIfMentionListboxOpened(); } // Simulate the actual pasting of content by passing the extracted HTML string as an argument and setting the format to 'text/html', // as in the [DataFormat](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) object. // For example, when copying a link, the clipboard stores information that includes the anchor tag, href attribute value etc, and paste it as an HTML string - public pasteHTMLToEditor(htmlString: string): void { + public async pasteHTMLToEditor(htmlString: string): Promise { const editor = this.getTiptapEditor(); const pasteEvent = new ClipboardEvent('paste', { clipboardData: new DataTransfer() }); pasteEvent.clipboardData?.setData('text/html', htmlString); editor.dispatchEvent(pasteEvent); + + await this.focusEditorIfMentionListboxOpened(); } public async setEditorTextContent(value: string): Promise { @@ -248,10 +252,7 @@ export class RichTextEditorPageObject { .run(); await waitForUpdatesAsync(); - if (this.isMentionListboxOpened()) { - this.richTextEditorElement.tiptapEditor.commands.focus(); - await waitForUpdatesAsync(); - } + await this.focusEditorIfMentionListboxOpened(); } public async setCursorPosition(position: number): Promise { @@ -265,6 +266,8 @@ export class RichTextEditorPageObject { const lastElement = this.getEditorLastChildElement(); lastElement.parentElement!.textContent = value; await waitForUpdatesAsync(); + + await this.focusEditorIfMentionListboxOpened(); } public async sliceEditorContent(from: number, to: number): Promise { @@ -274,18 +277,20 @@ export class RichTextEditorPageObject { .deleteRange({ from, to }) .run(); await waitForUpdatesAsync(); + + await this.focusEditorIfMentionListboxOpened(); } public getEditorLastChildAttribute(attribute: string): string { return getLastChildElementAttribute(attribute, this.getTiptapEditor()); } - public isMentionListboxOpened(): boolean { - return ( - !this.getMentionListbox() - ?.shadowRoot?.querySelector(anchoredRegionTag) - ?.hasAttribute('hidden') ?? false - ); + public async isMentionListboxOpened(): Promise { + await waitForUpdatesAsync(); + + return !this.getMentionListbox()?.shadowRoot?.querySelector( + anchoredRegionTag + )?.hidden; } public getEditorMentionViewAttributeValues(attribute: string): string[] { @@ -439,6 +444,8 @@ export class RichTextEditorPageObject { } public async clickMentionListboxOption(index: number): Promise { + await this.focusEditorIfMentionListboxOpened(); + const listOption = this.getAllListItemsInMentionBox()[index]; listOption?.click(); await waitForUpdatesAsync(); @@ -530,4 +537,11 @@ export class RichTextEditorPageObject { ); return parserMentionConfig; } + + private async focusEditorIfMentionListboxOpened(): Promise { + if (await this.isMentionListboxOpened()) { + this.richTextEditorElement.tiptapEditor.commands.focus(); + await waitForUpdatesAsync(); + } + } } diff --git a/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-mention.spec.ts b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-mention.spec.ts index 86638f51e7..b31e0d6ff0 100644 --- a/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-mention.spec.ts +++ b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor-mention.spec.ts @@ -765,7 +765,7 @@ describe('RichTextEditorMention', () => { const { userMentionElement } = await appendUserMentionConfiguration(element); const mentionUpdateSpy = jasmine.createSpy('mention-update'); userMentionElement.addEventListener('mention-update', mentionUpdateSpy); - pageObject.pasteToEditor('@test'); + await pageObject.pasteToEditor('@test'); await waitForUpdatesAsync(); expect(mentionUpdateSpy).toHaveBeenCalledTimes(1); }); @@ -808,7 +808,7 @@ describe('RichTextEditorMention', () => { ); const mentionUpdateSpy = jasmine.createSpy('mention-update'); userMentionElement.addEventListener('mention-update', mentionUpdateSpy); - pageObject.pasteHTMLToEditor(htmlContent); + await pageObject.pasteHTMLToEditor(htmlContent); expect(mentionUpdateSpy).toHaveBeenCalledTimes(0); }); @@ -930,7 +930,7 @@ describe('RichTextEditorMention', () => { value.input, [{ key: 'user:1', displayName: value.content }] ); - pageObject.pasteHTMLToEditor(htmlContent); + await pageObject.pasteHTMLToEditor(htmlContent); expect(pageObject.getEditorTagNamesWithClosingTags()).toEqual([ 'P', '/P' @@ -1067,7 +1067,7 @@ describe('RichTextEditor user mention via template', () => { it('should open mention popup, when button clicked', async () => { await pageObject.clickUserMentionButton(); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); }); }); @@ -1104,9 +1104,9 @@ describe('RichTextEditorMentionListbox', () => { { key: 'user:1', displayName: 'username1' }, { key: 'user:2', displayName: 'username2' } ]); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); expect(pageObject.getMentionListboxItemsName()).toEqual([ 'username1', 'username2' @@ -1143,9 +1143,9 @@ describe('RichTextEditorMentionListbox', () => { { key: 'user:1', displayName: 'username1' }, { key: 'user:2', displayName: 'username2' } ]); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); expect(pageObject.getMentionListboxItemsName()).toEqual([ 'username1', 'username2' @@ -1177,9 +1177,9 @@ describe('RichTextEditorMentionListbox', () => { await appendUserMentionConfiguration(element, [ { key: 'user:1', displayName: 'username1' } ]); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); await pageObject.clickMentionListboxOption(0); expect(pageObject.getMarkdownRenderedTagNames()).toEqual([ @@ -1189,16 +1189,16 @@ describe('RichTextEditorMentionListbox', () => { expect( pageObject.getEditorMentionViewAttributeValues('mention-label') ).toEqual(['username1']); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); it('should commit mention into the editor on Enter', async () => { await appendUserMentionConfiguration(element, [ { key: 'user:1', displayName: 'username1' } ]); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); await pageObject.pressEnterKeyInEditor(); expect(pageObject.getMarkdownRenderedTagNames()).toEqual([ @@ -1208,16 +1208,16 @@ describe('RichTextEditorMentionListbox', () => { expect( pageObject.getEditorMentionViewAttributeValues('mention-label') ).toEqual(['username1']); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); it('should commit mention into the editor on Tab', async () => { await appendUserMentionConfiguration(element, [ { key: 'user:1', displayName: 'username1' } ]); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); await pageObject.pressTabKeyInEditor(); expect(pageObject.getMarkdownRenderedTagNames()).toEqual([ @@ -1227,7 +1227,7 @@ describe('RichTextEditorMentionListbox', () => { expect( pageObject.getEditorMentionViewAttributeValues('mention-label') ).toEqual(['username1']); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); it('should close the popup when clicking Escape', async () => { @@ -1235,11 +1235,11 @@ describe('RichTextEditorMentionListbox', () => { { key: 'user:1', displayName: 'username1' }, { key: 'user:2', displayName: 'username2' } ]); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); await pageObject.pressEscapeKeyInEditor(); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); it('should filter and commit first mention into the editor on Enter', async () => { @@ -1321,7 +1321,7 @@ describe('RichTextEditorMentionListbox', () => { expect( pageObject.getEditorMentionViewAttributeValues('mention-label') ).toEqual(['username2']); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); it('should commit second option on arrow key down and tab', async () => { @@ -1340,7 +1340,7 @@ describe('RichTextEditorMentionListbox', () => { expect( pageObject.getEditorMentionViewAttributeValues('mention-label') ).toEqual(['username2']); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); it('focus out from the editor should close the mention popup', async () => { @@ -1350,11 +1350,11 @@ describe('RichTextEditorMentionListbox', () => { ]); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); await pageObject.focusOutEditor(); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); // WebKit skipped, see https://github.com/ni/nimble/issues/1938 @@ -1365,11 +1365,11 @@ describe('RichTextEditorMentionListbox', () => { ]); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); await pageObject.setDisabled(true); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); }); @@ -1383,14 +1383,14 @@ describe('RichTextEditorMentionListbox', () => { ] ); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); expect(pageObject.getMentionListboxItemsName()).toEqual([ 'username1', 'username2' ]); element.removeChild(userMentionElement); await waitForUpdatesAsync(); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); expect(pageObject.getMentionListboxItemsName()).toEqual([]); }); @@ -1409,7 +1409,7 @@ describe('RichTextEditorMentionListbox', () => { expect(pageObject.getMentionListboxItemsName()).toEqual([ 'username2' ]); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); }); it('should update mention popup list when mapping elements get replaced', async () => { @@ -1434,7 +1434,7 @@ describe('RichTextEditorMentionListbox', () => { 'username3', 'username4' ]); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); }); it('should close mention popup when updating to invalid `pattern`', async () => { @@ -1453,7 +1453,7 @@ describe('RichTextEditorMentionListbox', () => { userMentionElement.pattern = 'invalid'; await waitForUpdatesAsync(); expect(pageObject.getMentionListboxItemsName()).toEqual([]); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); it('should update mention popup list when updating `display-name`', async () => { @@ -1475,7 +1475,7 @@ describe('RichTextEditorMentionListbox', () => { 'updated-name', 'username2' ]); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); }); it('should update mention popup list when updating valid `key`', async () => { @@ -1484,7 +1484,7 @@ describe('RichTextEditorMentionListbox', () => { [{ key: 'invalid', displayName: 'username1' }] ); await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); expect(pageObject.getMentionListboxItemsName()).toEqual([]); mappingElements[0]!.key = 'user:1'; // After the first wait, `activeMappingConfigs` is updated, @@ -1495,7 +1495,7 @@ describe('RichTextEditorMentionListbox', () => { expect(pageObject.getMentionListboxItemsName()).toEqual([ 'username1' ]); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); }); it('should close mention popup when updating to invalid `key`', async () => { @@ -1514,7 +1514,7 @@ describe('RichTextEditorMentionListbox', () => { mappingElements[0]!.key = 'invalid'; await waitForUpdatesAsync(); expect(pageObject.getMentionListboxItemsName()).toEqual([]); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); it('should retain mention popup list position in the same cursor position when configuration got updated', async () => { @@ -1539,32 +1539,37 @@ describe('RichTextEditorMentionListbox', () => { 'New user', 'username2' ]); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); }); - // Intermittent, see https://github.com/ni/nimble/issues/2219 - xit('should show mention popup for multiple mention configuration elements', async () => { + it('should show mention popup for multiple mention configuration elements', async () => { await appendUserMentionConfiguration(element, [ { key: 'user:1', displayName: 'username1' }, { key: 'user:2', displayName: 'username2' } ]); + await pageObject.setEditorTextContent('@'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(pageObject.getMentionListboxItemsName()).toEqual([ 'username1', 'username2' ]); - await pageObject.clickMentionListboxOption(0); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); + + await pageObject.sliceEditorContent(0, 2); + await appendTestMentionConfiguration(element, [ { key: 'test:1', displayName: 'testname1' }, { key: 'test:2', displayName: 'testname2' } ]); + await pageObject.setEditorTextContent('!'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(pageObject.getMentionListboxItemsName()).toEqual([ 'testname1', 'testname2' ]); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); }); it('mention listbox should be closed when cursor position is moved to start and configuration dynamically changes', async () => { @@ -1573,12 +1578,12 @@ describe('RichTextEditorMentionListbox', () => { [{ key: 'user:1', displayName: 'user name1' }] ); await pageObject.setEditorTextContent('@user'); - expect(pageObject.isMentionListboxOpened()).toBeTrue(); + expect(await pageObject.isMentionListboxOpened()).toBeTrue(); await pageObject.setCursorPosition(1); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); mappingElements[0]!.displayName = 'user name2'; await waitForUpdatesAsync(); - expect(pageObject.isMentionListboxOpened()).toBeFalse(); + expect(await pageObject.isMentionListboxOpened()).toBeFalse(); }); }); }); diff --git a/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.spec.ts b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.spec.ts index bd3d3eaa9c..e26ad7592b 100644 --- a/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.spec.ts +++ b/packages/nimble-components/src/rich-text/editor/tests/rich-text-editor.spec.ts @@ -437,8 +437,8 @@ describe('RichTextEditor', () => { } ] as const; parameterizeSpec(markdownInput, (spec, name, value) => { - spec(`for ${name} markdown syntax to the editor`, () => { - pageObject.pasteToEditor(value.input); + spec(`for ${name} markdown syntax to the editor`, async () => { + await pageObject.pasteToEditor(value.input); expect(pageObject.getEditorTagNames()).toEqual(['P']); expect(pageObject.getEditorLeafContents()).toEqual([ @@ -1014,8 +1014,8 @@ describe('RichTextEditor', () => { parameterizeSpec(differentValidLinks, (spec, name, value) => { spec( `${name} renders as absolute link(href and text content should be same) in editor`, - () => { - pageObject.pasteHTMLToEditor(value.input); + async () => { + await pageObject.pasteHTMLToEditor(value.input); expect(pageObject.getEditorTagNames()).toEqual([ 'P', @@ -1051,8 +1051,8 @@ describe('RichTextEditor', () => { parameterizeSpec(validLinkNodes, (spec, name, value) => { spec( `${name} renders as absolute link(href and text content should be same) in editor`, - () => { - pageObject.pasteHTMLToEditor(value.input); + async () => { + await pageObject.pasteHTMLToEditor(value.input); expect( pageObject.getEditorTagNamesWithClosingTags() @@ -1134,19 +1134,24 @@ describe('RichTextEditor', () => { ] as const; parameterizeSpec(differentInvalidLinks, (spec, name, value) => { - spec(`${name} renders as plain text in editor`, () => { - pageObject.pasteHTMLToEditor(value.input); - - expect(pageObject.getEditorTagNames()).toEqual(['P']); - expect(pageObject.getEditorLeafContents()).toEqual([ - value.text - ]); - }); + spec( + `${name} renders as plain text in editor`, + async () => { + await pageObject.pasteHTMLToEditor(value.input); + + expect(pageObject.getEditorTagNames()).toEqual([ + 'P' + ]); + expect(pageObject.getEditorLeafContents()).toEqual([ + value.text + ]); + } + ); }); }); - it('pasting a plain text URL should render as a plain text', () => { - pageObject.pasteToEditor('https://nimble.ni.dev/'); + it('pasting a plain text URL should render as a plain text', async () => { + await pageObject.pasteToEditor('https://nimble.ni.dev/'); expect(pageObject.getEditorTagNames()).toEqual(['P']); expect(pageObject.getEditorLeafContents()).toEqual([ diff --git a/packages/nimble-components/src/rich-text/models/tests/markdown-serializer.spec.ts b/packages/nimble-components/src/rich-text/models/tests/markdown-serializer.spec.ts index 2e06cfb9f1..535c572473 100644 --- a/packages/nimble-components/src/rich-text/models/tests/markdown-serializer.spec.ts +++ b/packages/nimble-components/src/rich-text/models/tests/markdown-serializer.spec.ts @@ -337,12 +337,13 @@ Plain text 3`); `); }); - // Intermittent, see https://github.com/ni/nimble/issues/2219 - xit('Mention node', async () => { + it('Mention node', async () => { await appendUserMentionConfiguration(element, [ { key: 'user:1', displayName: 'username1' } ]); + await commitFirstMentionBoxOptionIntoEditor('@'); + expect(element.getMarkdown()).toEqual(' '); }); From aa1b0cafdadbbd42feb8bae3bd5ec9369138bd5b Mon Sep 17 00:00:00 2001 From: rajsite Date: Mon, 14 Oct 2024 08:37:04 -0500 Subject: [PATCH 2/4] applying package updates [skip ci] --- ...-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json | 7 ------ package-lock.json | 22 +++++++++---------- .../nimble-angular/CHANGELOG.json | 15 +++++++++++++ .../nimble-angular/CHANGELOG.md | 10 ++++++++- .../nimble-angular/package.json | 4 ++-- .../spright-angular/CHANGELOG.json | 15 +++++++++++++ .../spright-angular/CHANGELOG.md | 10 ++++++++- .../spright-angular/package.json | 4 ++-- .../NimbleBlazor/CHANGELOG.json | 15 +++++++++++++ .../NimbleBlazor/CHANGELOG.md | 10 ++++++++- .../NimbleBlazor/package.json | 4 ++-- .../SprightBlazor/CHANGELOG.json | 15 +++++++++++++ .../SprightBlazor/CHANGELOG.md | 10 ++++++++- .../SprightBlazor/package.json | 4 ++-- packages/nimble-components/CHANGELOG.json | 15 +++++++++++++ packages/nimble-components/CHANGELOG.md | 10 ++++++++- packages/nimble-components/package.json | 2 +- packages/spright-components/CHANGELOG.json | 15 +++++++++++++ packages/spright-components/CHANGELOG.md | 10 ++++++++- packages/spright-components/package.json | 4 ++-- 20 files changed, 166 insertions(+), 35 deletions(-) delete mode 100644 change/@ni-nimble-components-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json diff --git a/change/@ni-nimble-components-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json b/change/@ni-nimble-components-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json deleted file mode 100644 index a6d6481be6..0000000000 --- a/change/@ni-nimble-components-3798a360-e7c9-425c-b1b9-df4b1015ea4a.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "patch", - "comment": "Re-enable mention intermittently failed test cases", - "packageName": "@ni/nimble-components", - "email": "123377167+aagash-ni@users.noreply.github.com", - "dependentChangeType": "patch" -} diff --git a/package-lock.json b/package-lock.json index 498bf304c4..5b8efff0f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27974,7 +27974,7 @@ }, "packages/angular-workspace/nimble-angular": { "name": "@ni/nimble-angular", - "version": "28.2.10", + "version": "28.2.11", "license": "MIT", "dependencies": { "tslib": "^2.2.0" @@ -27985,12 +27985,12 @@ "@angular/forms": "^17.3.12", "@angular/localize": "^17.3.12", "@angular/router": "^17.3.12", - "@ni/nimble-components": "^32.3.0" + "@ni/nimble-components": "^32.3.1" } }, "packages/angular-workspace/spright-angular": { "name": "@ni/spright-angular", - "version": "5.1.11", + "version": "5.1.12", "license": "MIT", "dependencies": { "tslib": "^2.2.0" @@ -27998,7 +27998,7 @@ "peerDependencies": { "@angular/common": "^17.3.12", "@angular/core": "^17.3.12", - "@ni/spright-components": "^4.1.11" + "@ni/spright-components": "^4.1.12" } }, "packages/blazor-workspace": { @@ -28019,10 +28019,10 @@ }, "packages/blazor-workspace/NimbleBlazor": { "name": "@ni/nimble-blazor", - "version": "18.2.10", + "version": "18.2.11", "license": "MIT", "peerDependencies": { - "@ni/nimble-components": "^32.3.0", + "@ni/nimble-components": "^32.3.1", "@ni/nimble-tokens": "^8.3.0", "cross-env": "^7.0.3", "rimraf": "^6.0.0" @@ -28093,10 +28093,10 @@ }, "packages/blazor-workspace/SprightBlazor": { "name": "@ni/spright-blazor", - "version": "2.1.11", + "version": "2.1.12", "license": "MIT", "peerDependencies": { - "@ni/spright-components": "^4.1.11", + "@ni/spright-components": "^4.1.12", "cross-env": "^7.0.3", "rimraf": "^6.0.0" } @@ -28130,7 +28130,7 @@ }, "packages/nimble-components": { "name": "@ni/nimble-components", - "version": "32.3.0", + "version": "32.3.1", "license": "MIT", "dependencies": { "@microsoft/fast-colors": "^5.3.1", @@ -28249,12 +28249,12 @@ }, "packages/spright-components": { "name": "@ni/spright-components", - "version": "4.1.11", + "version": "4.1.12", "license": "MIT", "dependencies": { "@microsoft/fast-element": "^1.12.0", "@microsoft/fast-foundation": "^2.49.6", - "@ni/nimble-components": "^32.3.0", + "@ni/nimble-components": "^32.3.1", "tslib": "^2.2.0" }, "devDependencies": { diff --git a/packages/angular-workspace/nimble-angular/CHANGELOG.json b/packages/angular-workspace/nimble-angular/CHANGELOG.json index dcb7ab8737..e98956c5c7 100644 --- a/packages/angular-workspace/nimble-angular/CHANGELOG.json +++ b/packages/angular-workspace/nimble-angular/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/nimble-angular", "entries": [ + { + "date": "Mon, 14 Oct 2024 13:37:04 GMT", + "version": "28.2.11", + "tag": "@ni/nimble-angular_v28.2.11", + "comments": { + "patch": [ + { + "author": "beachball", + "package": "@ni/nimble-angular", + "comment": "Bump @ni/nimble-components to v32.3.1", + "commit": "not available" + } + ] + } + }, { "date": "Wed, 09 Oct 2024 22:13:53 GMT", "version": "28.2.10", diff --git a/packages/angular-workspace/nimble-angular/CHANGELOG.md b/packages/angular-workspace/nimble-angular/CHANGELOG.md index 5fe2b444f7..9f50289d79 100644 --- a/packages/angular-workspace/nimble-angular/CHANGELOG.md +++ b/packages/angular-workspace/nimble-angular/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - @ni/nimble-angular - + +## 28.2.11 + +Mon, 14 Oct 2024 13:37:04 GMT + +### Patches + +- Bump @ni/nimble-components to v32.3.1 + ## 28.2.10 Wed, 09 Oct 2024 19:24:18 GMT diff --git a/packages/angular-workspace/nimble-angular/package.json b/packages/angular-workspace/nimble-angular/package.json index c49fd14dee..454088101e 100644 --- a/packages/angular-workspace/nimble-angular/package.json +++ b/packages/angular-workspace/nimble-angular/package.json @@ -1,6 +1,6 @@ { "name": "@ni/nimble-angular", - "version": "28.2.10", + "version": "28.2.11", "description": "Angular components for the NI Nimble Design System", "scripts": { "invoke-publish": "npm run invoke-publish:setup && cd ../dist/nimble-angular && npm publish", @@ -32,7 +32,7 @@ "@angular/forms": "^17.3.12", "@angular/localize": "^17.3.12", "@angular/router": "^17.3.12", - "@ni/nimble-components": "^32.3.0" + "@ni/nimble-components": "^32.3.1" }, "dependencies": { "tslib": "^2.2.0" diff --git a/packages/angular-workspace/spright-angular/CHANGELOG.json b/packages/angular-workspace/spright-angular/CHANGELOG.json index f16cebaf2e..e45700e2a9 100644 --- a/packages/angular-workspace/spright-angular/CHANGELOG.json +++ b/packages/angular-workspace/spright-angular/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/spright-angular", "entries": [ + { + "date": "Mon, 14 Oct 2024 13:37:04 GMT", + "version": "5.1.12", + "tag": "@ni/spright-angular_v5.1.12", + "comments": { + "patch": [ + { + "author": "beachball", + "package": "@ni/spright-angular", + "comment": "Bump @ni/spright-components to v4.1.12", + "commit": "not available" + } + ] + } + }, { "date": "Wed, 09 Oct 2024 19:24:18 GMT", "version": "5.1.11", diff --git a/packages/angular-workspace/spright-angular/CHANGELOG.md b/packages/angular-workspace/spright-angular/CHANGELOG.md index b63acbdf8b..049c3ac958 100644 --- a/packages/angular-workspace/spright-angular/CHANGELOG.md +++ b/packages/angular-workspace/spright-angular/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - @ni/spright-angular - + +## 5.1.12 + +Mon, 14 Oct 2024 13:37:04 GMT + +### Patches + +- Bump @ni/spright-components to v4.1.12 + ## 5.1.11 Wed, 09 Oct 2024 19:24:18 GMT diff --git a/packages/angular-workspace/spright-angular/package.json b/packages/angular-workspace/spright-angular/package.json index 4526265004..88c693ba0e 100644 --- a/packages/angular-workspace/spright-angular/package.json +++ b/packages/angular-workspace/spright-angular/package.json @@ -1,6 +1,6 @@ { "name": "@ni/spright-angular", - "version": "5.1.11", + "version": "5.1.12", "description": "Angular components for NI Spright", "scripts": { "invoke-publish": "npm run invoke-publish:setup && cd ../dist/spright-angular && npm publish", @@ -24,7 +24,7 @@ "peerDependencies": { "@angular/common": "^17.3.12", "@angular/core": "^17.3.12", - "@ni/spright-components": "^4.1.11" + "@ni/spright-components": "^4.1.12" }, "dependencies": { "tslib": "^2.2.0" diff --git a/packages/blazor-workspace/NimbleBlazor/CHANGELOG.json b/packages/blazor-workspace/NimbleBlazor/CHANGELOG.json index 80bc5f6bb5..4b50d57e65 100644 --- a/packages/blazor-workspace/NimbleBlazor/CHANGELOG.json +++ b/packages/blazor-workspace/NimbleBlazor/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/nimble-blazor", "entries": [ + { + "date": "Mon, 14 Oct 2024 13:37:04 GMT", + "version": "18.2.11", + "tag": "@ni/nimble-blazor_v18.2.11", + "comments": { + "patch": [ + { + "author": "beachball", + "package": "@ni/nimble-blazor", + "comment": "Bump @ni/nimble-components to v32.3.1", + "commit": "not available" + } + ] + } + }, { "date": "Wed, 09 Oct 2024 19:24:18 GMT", "version": "18.2.10", diff --git a/packages/blazor-workspace/NimbleBlazor/CHANGELOG.md b/packages/blazor-workspace/NimbleBlazor/CHANGELOG.md index 0f468ab22a..a1d1508352 100644 --- a/packages/blazor-workspace/NimbleBlazor/CHANGELOG.md +++ b/packages/blazor-workspace/NimbleBlazor/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - @ni/nimble-blazor - + +## 18.2.11 + +Mon, 14 Oct 2024 13:37:04 GMT + +### Patches + +- Bump @ni/nimble-components to v32.3.1 + ## 18.2.10 Wed, 09 Oct 2024 19:24:18 GMT diff --git a/packages/blazor-workspace/NimbleBlazor/package.json b/packages/blazor-workspace/NimbleBlazor/package.json index 0475f77852..4c7ca597c6 100644 --- a/packages/blazor-workspace/NimbleBlazor/package.json +++ b/packages/blazor-workspace/NimbleBlazor/package.json @@ -1,6 +1,6 @@ { "name": "@ni/nimble-blazor", - "version": "18.2.10", + "version": "18.2.11", "description": "Blazor components for the NI Nimble Design System", "scripts": { "pack": "cross-env-shell dotnet pack -c Release -p:PackageVersion=$npm_package_version --output ../dist", @@ -25,7 +25,7 @@ "!*" ], "peerDependencies": { - "@ni/nimble-components": "^32.3.0", + "@ni/nimble-components": "^32.3.1", "@ni/nimble-tokens": "^8.3.0", "cross-env": "^7.0.3", "rimraf": "^6.0.0" diff --git a/packages/blazor-workspace/SprightBlazor/CHANGELOG.json b/packages/blazor-workspace/SprightBlazor/CHANGELOG.json index 0f27bd3408..ee0e9da2d9 100644 --- a/packages/blazor-workspace/SprightBlazor/CHANGELOG.json +++ b/packages/blazor-workspace/SprightBlazor/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/spright-blazor", "entries": [ + { + "date": "Mon, 14 Oct 2024 13:37:04 GMT", + "version": "2.1.12", + "tag": "@ni/spright-blazor_v2.1.12", + "comments": { + "patch": [ + { + "author": "beachball", + "package": "@ni/spright-blazor", + "comment": "Bump @ni/spright-components to v4.1.12", + "commit": "not available" + } + ] + } + }, { "date": "Wed, 09 Oct 2024 19:24:18 GMT", "version": "2.1.11", diff --git a/packages/blazor-workspace/SprightBlazor/CHANGELOG.md b/packages/blazor-workspace/SprightBlazor/CHANGELOG.md index bd0074077a..01539e472c 100644 --- a/packages/blazor-workspace/SprightBlazor/CHANGELOG.md +++ b/packages/blazor-workspace/SprightBlazor/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - @ni/spright-blazor - + +## 2.1.12 + +Mon, 14 Oct 2024 13:37:04 GMT + +### Patches + +- Bump @ni/spright-components to v4.1.12 + ## 2.1.11 Wed, 09 Oct 2024 19:24:18 GMT diff --git a/packages/blazor-workspace/SprightBlazor/package.json b/packages/blazor-workspace/SprightBlazor/package.json index ba1a075c0a..d2e5ec990e 100644 --- a/packages/blazor-workspace/SprightBlazor/package.json +++ b/packages/blazor-workspace/SprightBlazor/package.json @@ -1,6 +1,6 @@ { "name": "@ni/spright-blazor", - "version": "2.1.11", + "version": "2.1.12", "description": "Blazor components for Spright", "scripts": { "pack": "cross-env-shell dotnet pack -c Release -p:PackageVersion=$npm_package_version --output ../dist", @@ -25,7 +25,7 @@ "!*" ], "peerDependencies": { - "@ni/spright-components": "^4.1.11", + "@ni/spright-components": "^4.1.12", "cross-env": "^7.0.3", "rimraf": "^6.0.0" } diff --git a/packages/nimble-components/CHANGELOG.json b/packages/nimble-components/CHANGELOG.json index 9695564f1d..27514f6de1 100644 --- a/packages/nimble-components/CHANGELOG.json +++ b/packages/nimble-components/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/nimble-components", "entries": [ + { + "date": "Mon, 14 Oct 2024 13:37:04 GMT", + "version": "32.3.1", + "tag": "@ni/nimble-components_v32.3.1", + "comments": { + "patch": [ + { + "author": "123377167+aagash-ni@users.noreply.github.com", + "package": "@ni/nimble-components", + "commit": "69ed3ce08edd32638ec858f59e6c09790b8c0281", + "comment": "Re-enable mention intermittently failed test cases" + } + ] + } + }, { "date": "Wed, 09 Oct 2024 19:24:18 GMT", "version": "32.3.0", diff --git a/packages/nimble-components/CHANGELOG.md b/packages/nimble-components/CHANGELOG.md index 8ed2e4ec42..9b320d0417 100644 --- a/packages/nimble-components/CHANGELOG.md +++ b/packages/nimble-components/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - @ni/nimble-components - + +## 32.3.1 + +Mon, 14 Oct 2024 13:37:04 GMT + +### Patches + +- Re-enable mention intermittently failed test cases ([ni/nimble@69ed3ce](https://github.com/ni/nimble/commit/69ed3ce08edd32638ec858f59e6c09790b8c0281)) + ## 32.3.0 Wed, 09 Oct 2024 19:24:18 GMT diff --git a/packages/nimble-components/package.json b/packages/nimble-components/package.json index 3eb8c9c136..4ece926842 100644 --- a/packages/nimble-components/package.json +++ b/packages/nimble-components/package.json @@ -1,6 +1,6 @@ { "name": "@ni/nimble-components", - "version": "32.3.0", + "version": "32.3.1", "description": "Styled web components for the NI Nimble Design System", "scripts": { "build": "npm run generate-icons && npm run generate-workers && npm run build-components && npm run bundle-components && npm run generate-scss", diff --git a/packages/spright-components/CHANGELOG.json b/packages/spright-components/CHANGELOG.json index 979eb01455..44e341ebcf 100644 --- a/packages/spright-components/CHANGELOG.json +++ b/packages/spright-components/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/spright-components", "entries": [ + { + "date": "Mon, 14 Oct 2024 13:37:04 GMT", + "version": "4.1.12", + "tag": "@ni/spright-components_v4.1.12", + "comments": { + "patch": [ + { + "author": "beachball", + "package": "@ni/spright-components", + "comment": "Bump @ni/nimble-components to v32.3.1", + "commit": "not available" + } + ] + } + }, { "date": "Wed, 09 Oct 2024 19:24:18 GMT", "version": "4.1.11", diff --git a/packages/spright-components/CHANGELOG.md b/packages/spright-components/CHANGELOG.md index a5922d7959..b42b0c5e2c 100644 --- a/packages/spright-components/CHANGELOG.md +++ b/packages/spright-components/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - @ni/spright-components - + +## 4.1.12 + +Mon, 14 Oct 2024 13:37:04 GMT + +### Patches + +- Bump @ni/nimble-components to v32.3.1 + ## 4.1.11 Wed, 09 Oct 2024 19:24:18 GMT diff --git a/packages/spright-components/package.json b/packages/spright-components/package.json index 8ac7d09163..ab3173e003 100644 --- a/packages/spright-components/package.json +++ b/packages/spright-components/package.json @@ -1,6 +1,6 @@ { "name": "@ni/spright-components", - "version": "4.1.11", + "version": "4.1.12", "description": "NI Spright Components", "scripts": { "build": "npm run build-components && npm run bundle-components", @@ -50,7 +50,7 @@ "dependencies": { "@microsoft/fast-element": "^1.12.0", "@microsoft/fast-foundation": "^2.49.6", - "@ni/nimble-components": "^32.3.0", + "@ni/nimble-components": "^32.3.1", "tslib": "^2.2.0" }, "devDependencies": { From 280d85aab3c4cb9c78d4a336d2babbfd9bc33b8d Mon Sep 17 00:00:00 2001 From: mollykreis <20542556+mollykreis@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:17:45 -0500 Subject: [PATCH 3/4] Support error state on radio group in Angular and Blazor (#2433) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request ## ๐Ÿคจ Rationale Resolves #2019 by adding Angular and Blazor support for `error-text` and `error-visible` on the `nimble-radio-group`. ## ๐Ÿ‘ฉโ€๐Ÿ’ป Implementation - Expose error text and error visible on the radio group in Angular and Blazor - Update Angular and Blazor example apps to put a label on the radio group ## ๐Ÿงช Testing - Updated unit tests for the components - Manually verified that error text and error visible can be configured through both Angular and Blazor ## โœ… Checklist - [ ] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Milan Raj --- ...-4f066aff-68a7-4244-bfec-93033280f250.json | 7 ++ ...-9ba53191-8378-401c-a6c9-05fce98a89d0.json | 7 ++ .../app/customapp/customapp.component.html | 1 + .../nimble-radio-group.directive.ts | 16 ++++ .../nimble-radio-group.directive.spec.ts | 95 ++++++++++++++++++- .../Demo.Shared/Pages/ComponentsDemo.razor | 1 + .../Components/NimbleRadioGroup.razor | 2 + .../Components/NimbleRadioGroup.razor.cs | 12 +++ .../Unit/Components/NimbleRadioGroupTests.cs | 16 ++++ 9 files changed, 154 insertions(+), 3 deletions(-) create mode 100644 change/@ni-nimble-angular-4f066aff-68a7-4244-bfec-93033280f250.json create mode 100644 change/@ni-nimble-blazor-9ba53191-8378-401c-a6c9-05fce98a89d0.json diff --git a/change/@ni-nimble-angular-4f066aff-68a7-4244-bfec-93033280f250.json b/change/@ni-nimble-angular-4f066aff-68a7-4244-bfec-93033280f250.json new file mode 100644 index 0000000000..30e9e20dde --- /dev/null +++ b/change/@ni-nimble-angular-4f066aff-68a7-4244-bfec-93033280f250.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Expose error state on radio-group", + "packageName": "@ni/nimble-angular", + "email": "20542556+mollykreis@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/change/@ni-nimble-blazor-9ba53191-8378-401c-a6c9-05fce98a89d0.json b/change/@ni-nimble-blazor-9ba53191-8378-401c-a6c9-05fce98a89d0.json new file mode 100644 index 0000000000..4b2ae2f22d --- /dev/null +++ b/change/@ni-nimble-blazor-9ba53191-8378-401c-a6c9-05fce98a89d0.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Expose error state on radio-group", + "packageName": "@ni/nimble-blazor", + "email": "20542556+mollykreis@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/angular-workspace/example-client-app/src/app/customapp/customapp.component.html b/packages/angular-workspace/example-client-app/src/app/customapp/customapp.component.html index 112b7c9e39..0012056b01 100644 --- a/packages/angular-workspace/example-client-app/src/app/customapp/customapp.component.html +++ b/packages/angular-workspace/example-client-app/src/app/customapp/customapp.component.html @@ -74,6 +74,7 @@
Radio Buttons
+ Fruit Apple Banana Mango diff --git a/packages/angular-workspace/nimble-angular/src/directives/radio-group/nimble-radio-group.directive.ts b/packages/angular-workspace/nimble-angular/src/directives/radio-group/nimble-radio-group.directive.ts index ab8f734697..d23fd3205a 100644 --- a/packages/angular-workspace/nimble-angular/src/directives/radio-group/nimble-radio-group.directive.ts +++ b/packages/angular-workspace/nimble-angular/src/directives/radio-group/nimble-radio-group.directive.ts @@ -38,5 +38,21 @@ export class NimbleRadioGroupDirective { this.renderer.setProperty(this.elementRef.nativeElement, 'orientation', value); } + public get errorText(): string | undefined { + return this.elementRef.nativeElement.errorText; + } + + @Input('error-text') public set errorText(value: string | undefined) { + this.renderer.setProperty(this.elementRef.nativeElement, 'errorText', value); + } + + public get errorVisible(): boolean { + return this.elementRef.nativeElement.errorVisible; + } + + @Input('error-visible') public set errorVisible(value: BooleanValueOrAttribute) { + this.renderer.setProperty(this.elementRef.nativeElement, 'errorVisible', toBooleanProperty(value)); + } + public constructor(private readonly renderer: Renderer2, private readonly elementRef: ElementRef) {} } diff --git a/packages/angular-workspace/nimble-angular/src/directives/radio-group/tests/nimble-radio-group.directive.spec.ts b/packages/angular-workspace/nimble-angular/src/directives/radio-group/tests/nimble-radio-group.directive.spec.ts index 89733b336a..28d133c4e8 100644 --- a/packages/angular-workspace/nimble-angular/src/directives/radio-group/tests/nimble-radio-group.directive.spec.ts +++ b/packages/angular-workspace/nimble-angular/src/directives/radio-group/tests/nimble-radio-group.directive.spec.ts @@ -70,11 +70,28 @@ describe('Nimble radio group', () => { directive.orientation = Orientation.vertical; expect(nativeElement.orientation).toBe(Orientation.vertical); }); + + it('has expected defaults for errorText', () => { + expect(directive.errorText).toBeUndefined(); + expect(nativeElement.errorText).toBeUndefined(); + }); + + it('can use the directive to set errorText', () => { + directive.errorText = 'new value'; + expect(nativeElement.errorText).toBe('new value'); + }); }); describe('with template string values', () => { @Component({ - template: '' + template: ` + ` }) class TestHostComponent { @ViewChild('radioGroup', { read: NimbleRadioGroupDirective }) public directive: NimbleRadioGroupDirective; @@ -110,11 +127,28 @@ describe('Nimble radio group', () => { expect(directive.orientation).toBe(Orientation.vertical); expect(nativeElement.orientation).toBe(Orientation.vertical); }); + + it('will use template string values for errorText', () => { + expect(directive.errorText).toBe('error text'); + expect(nativeElement.errorText).toBe('error text'); + }); + + it('will use template string values for errorVisible', () => { + expect(directive.errorVisible).toBeTrue(); + expect(nativeElement.errorVisible).toBeTrue(); + }); }); describe('with property bound values', () => { @Component({ - template: '' + template: ` + ` }) class TestHostComponent { @ViewChild('radioGroup', { read: NimbleRadioGroupDirective }) public directive: NimbleRadioGroupDirective; @@ -122,6 +156,8 @@ describe('Nimble radio group', () => { public disabled = false; public name = 'foo'; public orientation: Orientation = Orientation.vertical; + public errorText = 'initial value'; + public errorVisible = false; } let fixture: ComponentFixture; @@ -171,11 +207,40 @@ describe('Nimble radio group', () => { expect(directive.orientation).toBe(Orientation.horizontal); expect(nativeElement.orientation).toBe(Orientation.horizontal); }); + + it('can be configured with property binding for errorText', () => { + expect(directive.errorText).toBe('initial value'); + expect(nativeElement.errorText).toBe('initial value'); + + fixture.componentInstance.errorText = 'new value'; + fixture.detectChanges(); + + expect(directive.errorText).toBe('new value'); + expect(nativeElement.errorText).toBe('new value'); + }); + + it('can be configured with property binding for errorVisible', () => { + expect(directive.errorVisible).toBeFalse(); + expect(nativeElement.errorVisible).toBeFalse(); + + fixture.componentInstance.errorVisible = true; + fixture.detectChanges(); + + expect(directive.errorVisible).toBeTrue(); + expect(nativeElement.errorVisible).toBeTrue(); + }); }); describe('with attribute bound values', () => { @Component({ - template: '' + template: ` + ` }) class TestHostComponent { @ViewChild('radioGroup', { read: NimbleRadioGroupDirective }) public directive: NimbleRadioGroupDirective; @@ -183,6 +248,8 @@ describe('Nimble radio group', () => { public disabled: BooleanValueOrAttribute = null; public name = 'foo'; public orientation: Orientation = Orientation.vertical; + public errorText = 'initial value'; + public errorVisible: BooleanValueOrAttribute = null; } let fixture: ComponentFixture; @@ -232,5 +299,27 @@ describe('Nimble radio group', () => { expect(directive.orientation).toBe(Orientation.horizontal); expect(nativeElement.orientation).toBe(Orientation.horizontal); }); + + it('can be configured with attribute binding for errorText', () => { + expect(directive.errorText).toBe('initial value'); + expect(nativeElement.errorText).toBe('initial value'); + + fixture.componentInstance.errorText = 'new value'; + fixture.detectChanges(); + + expect(directive.errorText).toBe('new value'); + expect(nativeElement.errorText).toBe('new value'); + }); + + it('can be configured with attribute binding for errorVisible', () => { + expect(directive.errorVisible).toBeFalse(); + expect(nativeElement.errorVisible).toBeFalse(); + + fixture.componentInstance.errorVisible = ''; + fixture.detectChanges(); + + expect(directive.errorVisible).toBeTrue(); + expect(nativeElement.errorVisible).toBeTrue(); + }); }); }); \ No newline at end of file diff --git a/packages/blazor-workspace/Examples/Demo.Shared/Pages/ComponentsDemo.razor b/packages/blazor-workspace/Examples/Demo.Shared/Pages/ComponentsDemo.razor index b1cfb981a1..c9a5932b31 100644 --- a/packages/blazor-workspace/Examples/Demo.Shared/Pages/ComponentsDemo.razor +++ b/packages/blazor-workspace/Examples/Demo.Shared/Pages/ComponentsDemo.razor @@ -91,6 +91,7 @@
Radio Buttons
+ Options Option 1 Option 2 Option 3 diff --git a/packages/blazor-workspace/NimbleBlazor/Components/NimbleRadioGroup.razor b/packages/blazor-workspace/NimbleBlazor/Components/NimbleRadioGroup.razor index 7126ca671b..a1977d4386 100644 --- a/packages/blazor-workspace/NimbleBlazor/Components/NimbleRadioGroup.razor +++ b/packages/blazor-workspace/NimbleBlazor/Components/NimbleRadioGroup.razor @@ -3,6 +3,8 @@ diff --git a/packages/blazor-workspace/NimbleBlazor/Components/NimbleRadioGroup.razor.cs b/packages/blazor-workspace/NimbleBlazor/Components/NimbleRadioGroup.razor.cs index 2409272603..0d017beda7 100644 --- a/packages/blazor-workspace/NimbleBlazor/Components/NimbleRadioGroup.razor.cs +++ b/packages/blazor-workspace/NimbleBlazor/Components/NimbleRadioGroup.razor.cs @@ -23,6 +23,18 @@ public partial class NimbleRadioGroup : NimbleInputBase [Parameter] public Orientation? Orientation { get; set; } + /// + /// Gets or sets whether the error state is displayed + /// + [Parameter] + public bool? ErrorVisible { get; set; } + + /// + /// Gets or sets an error message describing the error state + /// + [Parameter] + public string? ErrorText { get; set; } + /// /// Gets or sets the child content to be rendered inside the . /// diff --git a/packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleRadioGroupTests.cs b/packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleRadioGroupTests.cs index be2e13a6ee..26ae0a5efa 100644 --- a/packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleRadioGroupTests.cs +++ b/packages/blazor-workspace/Tests/NimbleBlazor.Tests/Unit/Components/NimbleRadioGroupTests.cs @@ -66,6 +66,22 @@ public void NimbleRadioGroupName_AttributeIsSet() Assert.Contains("name", radioGroup.Markup); } + [Fact] + public void NimbleRadioGroupErrorText_AttributeIsSet() + { + var radioGroup = RenderNimbleRadioGroupWithPropertySet(x => x.ErrorText, "bad value"); + + Assert.Contains("error-text=\"bad value\"", radioGroup.Markup); + } + + [Fact] + public void NimbleRadioGroupErrorVisible_AttributeIsSet() + { + var radioGroup = RenderNimbleRadioGroupWithPropertySet(x => x.ErrorVisible, true); + + Assert.Contains("error-visible", radioGroup.Markup); + } + private IRenderedComponent RenderNimbleRadioGroupWithPropertySet(Expression> propertyGetter, TProperty propertyValue) { var context = new TestContext(); From 195a76480528f72d0c2169673d556b744e3484d8 Mon Sep 17 00:00:00 2001 From: rajsite Date: Wed, 16 Oct 2024 16:20:29 -0500 Subject: [PATCH 4/4] applying package updates [skip ci] --- ...ular-4f066aff-68a7-4244-bfec-93033280f250.json | 7 ------- ...azor-9ba53191-8378-401c-a6c9-05fce98a89d0.json | 7 ------- package-lock.json | 4 ++-- .../nimble-angular/CHANGELOG.json | 15 +++++++++++++++ .../angular-workspace/nimble-angular/CHANGELOG.md | 10 +++++++++- .../angular-workspace/nimble-angular/package.json | 2 +- .../blazor-workspace/NimbleBlazor/CHANGELOG.json | 15 +++++++++++++++ .../blazor-workspace/NimbleBlazor/CHANGELOG.md | 10 +++++++++- .../blazor-workspace/NimbleBlazor/package.json | 2 +- 9 files changed, 52 insertions(+), 20 deletions(-) delete mode 100644 change/@ni-nimble-angular-4f066aff-68a7-4244-bfec-93033280f250.json delete mode 100644 change/@ni-nimble-blazor-9ba53191-8378-401c-a6c9-05fce98a89d0.json diff --git a/change/@ni-nimble-angular-4f066aff-68a7-4244-bfec-93033280f250.json b/change/@ni-nimble-angular-4f066aff-68a7-4244-bfec-93033280f250.json deleted file mode 100644 index 30e9e20dde..0000000000 --- a/change/@ni-nimble-angular-4f066aff-68a7-4244-bfec-93033280f250.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "minor", - "comment": "Expose error state on radio-group", - "packageName": "@ni/nimble-angular", - "email": "20542556+mollykreis@users.noreply.github.com", - "dependentChangeType": "patch" -} diff --git a/change/@ni-nimble-blazor-9ba53191-8378-401c-a6c9-05fce98a89d0.json b/change/@ni-nimble-blazor-9ba53191-8378-401c-a6c9-05fce98a89d0.json deleted file mode 100644 index 4b2ae2f22d..0000000000 --- a/change/@ni-nimble-blazor-9ba53191-8378-401c-a6c9-05fce98a89d0.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "minor", - "comment": "Expose error state on radio-group", - "packageName": "@ni/nimble-blazor", - "email": "20542556+mollykreis@users.noreply.github.com", - "dependentChangeType": "patch" -} diff --git a/package-lock.json b/package-lock.json index 5b8efff0f6..883ec109f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27974,7 +27974,7 @@ }, "packages/angular-workspace/nimble-angular": { "name": "@ni/nimble-angular", - "version": "28.2.11", + "version": "28.3.0", "license": "MIT", "dependencies": { "tslib": "^2.2.0" @@ -28019,7 +28019,7 @@ }, "packages/blazor-workspace/NimbleBlazor": { "name": "@ni/nimble-blazor", - "version": "18.2.11", + "version": "18.3.0", "license": "MIT", "peerDependencies": { "@ni/nimble-components": "^32.3.1", diff --git a/packages/angular-workspace/nimble-angular/CHANGELOG.json b/packages/angular-workspace/nimble-angular/CHANGELOG.json index e98956c5c7..d8a40301e9 100644 --- a/packages/angular-workspace/nimble-angular/CHANGELOG.json +++ b/packages/angular-workspace/nimble-angular/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/nimble-angular", "entries": [ + { + "date": "Wed, 16 Oct 2024 21:20:29 GMT", + "version": "28.3.0", + "tag": "@ni/nimble-angular_v28.3.0", + "comments": { + "minor": [ + { + "author": "20542556+mollykreis@users.noreply.github.com", + "package": "@ni/nimble-angular", + "commit": "280d85aab3c4cb9c78d4a336d2babbfd9bc33b8d", + "comment": "Expose error state on radio-group" + } + ] + } + }, { "date": "Mon, 14 Oct 2024 13:37:04 GMT", "version": "28.2.11", diff --git a/packages/angular-workspace/nimble-angular/CHANGELOG.md b/packages/angular-workspace/nimble-angular/CHANGELOG.md index 9f50289d79..7393518d46 100644 --- a/packages/angular-workspace/nimble-angular/CHANGELOG.md +++ b/packages/angular-workspace/nimble-angular/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - @ni/nimble-angular - + +## 28.3.0 + +Wed, 16 Oct 2024 21:20:29 GMT + +### Minor changes + +- Expose error state on radio-group ([ni/nimble@280d85a](https://github.com/ni/nimble/commit/280d85aab3c4cb9c78d4a336d2babbfd9bc33b8d)) + ## 28.2.11 Mon, 14 Oct 2024 13:37:04 GMT diff --git a/packages/angular-workspace/nimble-angular/package.json b/packages/angular-workspace/nimble-angular/package.json index 454088101e..b9b4479a91 100644 --- a/packages/angular-workspace/nimble-angular/package.json +++ b/packages/angular-workspace/nimble-angular/package.json @@ -1,6 +1,6 @@ { "name": "@ni/nimble-angular", - "version": "28.2.11", + "version": "28.3.0", "description": "Angular components for the NI Nimble Design System", "scripts": { "invoke-publish": "npm run invoke-publish:setup && cd ../dist/nimble-angular && npm publish", diff --git a/packages/blazor-workspace/NimbleBlazor/CHANGELOG.json b/packages/blazor-workspace/NimbleBlazor/CHANGELOG.json index 4b50d57e65..20653b3ab7 100644 --- a/packages/blazor-workspace/NimbleBlazor/CHANGELOG.json +++ b/packages/blazor-workspace/NimbleBlazor/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/nimble-blazor", "entries": [ + { + "date": "Wed, 16 Oct 2024 21:20:29 GMT", + "version": "18.3.0", + "tag": "@ni/nimble-blazor_v18.3.0", + "comments": { + "minor": [ + { + "author": "20542556+mollykreis@users.noreply.github.com", + "package": "@ni/nimble-blazor", + "commit": "280d85aab3c4cb9c78d4a336d2babbfd9bc33b8d", + "comment": "Expose error state on radio-group" + } + ] + } + }, { "date": "Mon, 14 Oct 2024 13:37:04 GMT", "version": "18.2.11", diff --git a/packages/blazor-workspace/NimbleBlazor/CHANGELOG.md b/packages/blazor-workspace/NimbleBlazor/CHANGELOG.md index a1d1508352..5b88bd52a5 100644 --- a/packages/blazor-workspace/NimbleBlazor/CHANGELOG.md +++ b/packages/blazor-workspace/NimbleBlazor/CHANGELOG.md @@ -1,9 +1,17 @@ # Change Log - @ni/nimble-blazor - + +## 18.3.0 + +Wed, 16 Oct 2024 21:20:29 GMT + +### Minor changes + +- Expose error state on radio-group ([ni/nimble@280d85a](https://github.com/ni/nimble/commit/280d85aab3c4cb9c78d4a336d2babbfd9bc33b8d)) + ## 18.2.11 Mon, 14 Oct 2024 13:37:04 GMT diff --git a/packages/blazor-workspace/NimbleBlazor/package.json b/packages/blazor-workspace/NimbleBlazor/package.json index 4c7ca597c6..9b531929e7 100644 --- a/packages/blazor-workspace/NimbleBlazor/package.json +++ b/packages/blazor-workspace/NimbleBlazor/package.json @@ -1,6 +1,6 @@ { "name": "@ni/nimble-blazor", - "version": "18.2.11", + "version": "18.3.0", "description": "Blazor components for the NI Nimble Design System", "scripts": { "pack": "cross-env-shell dotnet pack -c Release -p:PackageVersion=$npm_package_version --output ../dist",