parent
f7c0d37bdb
commit
323487bee0
@ -0,0 +1,24 @@ |
||||
import {Component, OnInit} from "@angular/core"; |
||||
import {ApiV3FilterBuilder} from "core-components/api/api-v3/api-v3-filter-builder"; |
||||
import {WidgetWpListComponent} from "core-app/modules/grids/widgets/wp-widget/wp-widget.component"; |
||||
|
||||
@Component({ |
||||
templateUrl: '../wp-widget/wp-widget.component.html', |
||||
styleUrls: ['../wp-widget/wp-widget.component.css'] |
||||
}) |
||||
export class WidgetWpTableComponent extends WidgetWpListComponent implements OnInit { |
||||
public text = { title: this.i18n.t('js.grid.widgets.work_packages_table.title') }; |
||||
public queryProps:any; |
||||
|
||||
ngOnInit() { |
||||
super.ngOnInit(); |
||||
// TODO: adapt to arbitrary query
|
||||
let filters = new ApiV3FilterBuilder(); |
||||
filters.add('watcher', '=', ["me"]); |
||||
filters.add('status', 'o', []); |
||||
|
||||
this.queryProps = {"columns[]":["id", "project", "type", "subject"], |
||||
"filters":filters.toJson()}; |
||||
|
||||
} |
||||
} |
@ -0,0 +1,96 @@ |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2018 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See docs/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
require 'spec_helper' |
||||
|
||||
describe 'Arbitrary WorkPackage query table widget widget on my page', type: :feature, js: true do |
||||
let!(:type) { FactoryBot.create :type } |
||||
let!(:other_type) { FactoryBot.create :type } |
||||
let!(:priority) { FactoryBot.create :default_priority } |
||||
let!(:project) { FactoryBot.create :project, types: [type] } |
||||
let!(:other_project) { FactoryBot.create :project, types: [type] } |
||||
let!(:open_status) { FactoryBot.create :default_status } |
||||
let!(:type_work_package) do |
||||
FactoryBot.create :work_package, |
||||
project: project, |
||||
type: type, |
||||
author: user, |
||||
responsible: user |
||||
end |
||||
let!(:other_type_work_package) do |
||||
FactoryBot.create :work_package, |
||||
project: project, |
||||
type: other_type, |
||||
author: user, |
||||
responsible: user |
||||
end |
||||
|
||||
let(:role) { FactoryBot.create(:role, permissions: %i[view_work_packages add_work_packages]) } |
||||
|
||||
let(:user) do |
||||
FactoryBot.create(:user, |
||||
member_in_project: project, |
||||
member_through_role: role) |
||||
end |
||||
let(:my_page) do |
||||
Pages::My::Page.new |
||||
end |
||||
|
||||
before do |
||||
login_as user |
||||
|
||||
my_page.visit! |
||||
end |
||||
|
||||
it 'can add the widget and see the work packages of the filtered for types' do |
||||
my_page.add_column(3, before_or_after: :before) |
||||
|
||||
my_page.add_widget(2, 3, "Work package table") |
||||
|
||||
sleep(0.2) |
||||
|
||||
filter_area = Components::Grids::GridArea.new('.grid--area', text: "Work package table") |
||||
created_area = Components::Grids::GridArea.new('.grid--area', text: "Work packages created by me") |
||||
|
||||
filter_area.expect_to_span(2, 3, 5, 4) |
||||
filter_area.resize_to(6, 4) |
||||
|
||||
filter_area.expect_to_span(2, 3, 7, 5) |
||||
## enlarging the accountable area will have moved the created area down |
||||
created_area.expect_to_span(7, 4, 13, 6) |
||||
|
||||
#expect(accountable_area.area) |
||||
# .to have_selector('.subject', text: accountable_work_package.subject) |
||||
|
||||
#expect(accountable_area.area) |
||||
# .to have_no_selector('.subject', text: accountable_by_other_work_package.subject) |
||||
|
||||
#expect(accountable_area.area) |
||||
# .to have_no_selector('.subject', text: accountable_but_invisible_work_package.subject) |
||||
end |
||||
end |
Loading…
Reference in new issue