mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[AAE-5874] Re-evaluate extension rules when context changes (#2296)
* [AAE-5874] Re-evaluate extension rules when context changes * [AAE-5874] Add disabled attribute to toolbar actions * [AAE-5874] Fix unit tests
This commit is contained in:
committed by
Denys Vuika
parent
46a179c75a
commit
c4e4b50f8a
@@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { ContextMenuComponent } from './context-menu.component';
|
||||
import { ContextMenuModule } from './context-menu.module';
|
||||
@@ -75,7 +75,7 @@ describe('ContextMenuComponent', () => {
|
||||
contextMenuOverlayRef = TestBed.inject(ContextMenuOverlayRef);
|
||||
extensionsService = TestBed.inject(AppExtensionService);
|
||||
|
||||
spyOn(extensionsService, 'getAllowedContextMenuActions').and.returnValue([contextItem]);
|
||||
spyOn(extensionsService, 'getAllowedContextMenuActions').and.returnValue(of([contextItem]));
|
||||
|
||||
fixture.detectChanges();
|
||||
});
|
||||
@@ -85,15 +85,16 @@ describe('ContextMenuComponent', () => {
|
||||
expect(contextMenuOverlayRef.close).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should render defined context menu actions items', fakeAsync(() => {
|
||||
it('should render defined context menu actions items', async () => {
|
||||
component.ngAfterViewInit();
|
||||
tick(500);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
const contextMenuElements = document.body.querySelector('.aca-context-menu').querySelectorAll('button');
|
||||
|
||||
expect(contextMenuElements.length).toBe(1);
|
||||
expect(contextMenuElements[0].querySelector('span').innerText).toBe(contextItem.title);
|
||||
}));
|
||||
});
|
||||
|
||||
it('should run action with provided action id', () => {
|
||||
spyOn(extensionsService, 'runActionById');
|
||||
|
Reference in New Issue
Block a user