mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Do not display the "Add widget" button unless the available widgets are loaded.
Fixing flaky specs related to displaying empty add widget modals.
This commit is contained in:
@@ -16,14 +16,16 @@ import { I18nService } from 'core-app/core/i18n/i18n.service';
|
||||
export class GridAddWidgetService {
|
||||
text = { add: this.i18n.t('js.grid.add_widget') };
|
||||
|
||||
constructor(readonly opModalService:OpModalService,
|
||||
constructor(
|
||||
readonly opModalService:OpModalService,
|
||||
readonly injector:Injector,
|
||||
readonly halResource:HalResourceService,
|
||||
readonly layout:GridAreaService,
|
||||
readonly drag:GridDragAndDropService,
|
||||
readonly move:GridMoveService,
|
||||
readonly resize:GridResizeService,
|
||||
readonly i18n:I18nService) {
|
||||
readonly i18n:I18nService
|
||||
) {
|
||||
}
|
||||
|
||||
public isAddable(area:GridArea) {
|
||||
@@ -120,6 +122,6 @@ export class GridAddWidgetService {
|
||||
}
|
||||
|
||||
public get isAllowed() {
|
||||
return this.layout.gridResource && this.layout.gridResource.updateImmediately;
|
||||
return this.layout.gridResource && this.layout.gridResource.updateImmediately && this.layout.schema;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,17 +83,21 @@ module Pages
|
||||
area = area_of(row_number, column_number, location)
|
||||
area.hover
|
||||
|
||||
add_widget_button = if using_cuprite?
|
||||
area.find(".grid--widget-add")
|
||||
else
|
||||
area.find(".grid--widget-add", visible: :all)
|
||||
end
|
||||
enable_add_widget_mode_for(area)
|
||||
|
||||
add_widget_button = area.find(".grid--widget-add")
|
||||
add_widget_button.click
|
||||
|
||||
within(".spot-modal", &)
|
||||
end
|
||||
|
||||
def enable_add_widget_mode_for(area)
|
||||
within('.toolbar-items') do
|
||||
button = find_button "Add widget"
|
||||
button.click if button[:class].exclude? "-active"
|
||||
end
|
||||
end
|
||||
|
||||
def expect_widget_adding_prohibited_generally(row_number = 1, column_number = 1)
|
||||
area = area_of(row_number, column_number)
|
||||
area.hover
|
||||
|
||||
Reference in New Issue
Block a user