diff --git a/angular-workspace/projects/example-client-app/src/test.ts b/angular-workspace/projects/example-client-app/src/test.ts index 6cd2ad3b3c..955bf3897b 100644 --- a/angular-workspace/projects/example-client-app/src/test.ts +++ b/angular-workspace/projects/example-client-app/src/test.ts @@ -1,5 +1,6 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files +import 'zone.js'; import 'zone.js/testing'; import { getTestBed } from '@angular/core/testing'; import { @@ -19,7 +20,8 @@ getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting(), { - teardown: { destroyAfterEach: false } + errorOnUnknownElements: true, + errorOnUnknownProperties: true } ); // Then we find all the tests. @@ -27,9 +29,6 @@ const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context); -// Workaround to make console.error calls fail tests: -// https://github.com/angular/angular/issues/36430#issuecomment-874772398 -// Might be removable after upgrading to Angular 14: -// https://github.com/angular/angular/issues/36430#issuecomment-1117801535 +// Elevate console errors to test failures // eslint-disable-next-line no-console, @typescript-eslint/no-explicit-any -console.error = (data: any): void => fail(data); \ No newline at end of file +console.error = (data: any): void => fail(data); diff --git a/angular-workspace/projects/ni/nimble-angular/CHANGELOG.json b/angular-workspace/projects/ni/nimble-angular/CHANGELOG.json index 98fe61bab3..136f06df37 100644 --- a/angular-workspace/projects/ni/nimble-angular/CHANGELOG.json +++ b/angular-workspace/projects/ni/nimble-angular/CHANGELOG.json @@ -1,6 +1,21 @@ { "name": "@ni/nimble-angular", "entries": [ + { + "date": "Wed, 06 Sep 2023 13:58:34 GMT", + "tag": "@ni/nimble-angular_v17.2.1", + "version": "17.2.1", + "comments": { + "none": [ + { + "author": "rajsite@users.noreply.github.com", + "package": "@ni/nimble-angular", + "commit": "641593fb78886144aa783c0a54b894a5bdb8a6f2", + "comment": "Align the test.ts configuration" + } + ] + } + }, { "date": "Wed, 06 Sep 2023 05:43:09 GMT", "tag": "@ni/nimble-angular_v17.2.1", diff --git a/angular-workspace/projects/ni/nimble-angular/test.ts b/angular-workspace/projects/ni/nimble-angular/test.ts index 2ba428fb11..955bf3897b 100644 --- a/angular-workspace/projects/ni/nimble-angular/test.ts +++ b/angular-workspace/projects/ni/nimble-angular/test.ts @@ -20,7 +20,6 @@ getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting(), { - teardown: { destroyAfterEach: false }, errorOnUnknownElements: true, errorOnUnknownProperties: true } @@ -32,4 +31,4 @@ context.keys().map(context); // Elevate console errors to test failures // eslint-disable-next-line no-console, @typescript-eslint/no-explicit-any -console.error = (data: any): void => fail(data); \ No newline at end of file +console.error = (data: any): void => fail(data); diff --git a/change/@ni-nimble-components-980520f6-8e70-4789-be9c-89be52706a37.json b/change/@ni-nimble-components-980520f6-8e70-4789-be9c-89be52706a37.json new file mode 100644 index 0000000000..6443b350e1 --- /dev/null +++ b/change/@ni-nimble-components-980520f6-8e70-4789-be9c-89be52706a37.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Revert firefox workaround for caret disappear", + "packageName": "@ni/nimble-components", + "email": "123377167+aagash-ni@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/nimble-components/src/rich-text-editor/index.ts b/packages/nimble-components/src/rich-text-editor/index.ts index df1cd53f9b..cad41fbc04 100644 --- a/packages/nimble-components/src/rich-text-editor/index.ts +++ b/packages/nimble-components/src/rich-text-editor/index.ts @@ -227,7 +227,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { */ public boldButtonClick(): void { this.tiptapEditor.chain().focus().toggleBold().run(); - this.forceFocusEditor(); } /** @@ -237,7 +236,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { public boldButtonKeyDown(event: KeyboardEvent): boolean { if (this.keyActivatesButton(event)) { this.tiptapEditor.chain().focus().toggleBold().run(); - this.forceFocusEditor(); return false; } return true; @@ -249,7 +247,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { */ public italicsButtonClick(): void { this.tiptapEditor.chain().focus().toggleItalic().run(); - this.forceFocusEditor(); } /** @@ -259,7 +256,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { public italicsButtonKeyDown(event: KeyboardEvent): boolean { if (this.keyActivatesButton(event)) { this.tiptapEditor.chain().focus().toggleItalic().run(); - this.forceFocusEditor(); return false; } return true; @@ -271,7 +267,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { */ public bulletListButtonClick(): void { this.tiptapEditor.chain().focus().toggleBulletList().run(); - this.forceFocusEditor(); } /** @@ -281,7 +276,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { public bulletListButtonKeyDown(event: KeyboardEvent): boolean { if (this.keyActivatesButton(event)) { this.tiptapEditor.chain().focus().toggleBulletList().run(); - this.forceFocusEditor(); return false; } return true; @@ -293,7 +287,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { */ public numberedListButtonClick(): void { this.tiptapEditor.chain().focus().toggleOrderedList().run(); - this.forceFocusEditor(); } /** @@ -303,7 +296,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { public numberedListButtonKeyDown(event: KeyboardEvent): boolean { if (this.keyActivatesButton(event)) { this.tiptapEditor.chain().focus().toggleOrderedList().run(); - this.forceFocusEditor(); return false; } return true; @@ -566,15 +558,6 @@ export class RichTextEditor extends FoundationElement implements ErrorPattern { } }); } - - // In Firefox browser, once the editor gets focused, the blinking caret will be visible until we click format buttons (Bold, Italic ...) in the Firefox browser (changing focus). - // But once any of the toolbar button is clicked, editor internally has its focus but the blinking caret disappears. - // As a workaround, manually triggering blur and setting focus on editor makes the blinking caret to re-appear. - // Mozilla issue https://bugzilla.mozilla.org/show_bug.cgi?id=1496769 tracks removal of this workaround. - private forceFocusEditor(): void { - this.tiptapEditor.commands.blur(); - this.tiptapEditor.commands.focus(); - } } // eslint-disable-next-line @typescript-eslint/no-empty-interface