mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Skeleton specs for BorderBoxTableComponent impls.
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Saml::Providers::TableComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
subject(:rendered_component) do
|
||||
with_controller_class(Saml::ProvidersController) do
|
||||
with_request_url("/admin/saml/providers") do
|
||||
render_component(rows: saml_providers)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "Name"
|
||||
include_examples "rendering Border Box Grid heading", text: "Users"
|
||||
include_examples "rendering Border Box Grid heading", text: "Created by"
|
||||
include_examples "rendering Border Box Grid heading", text: "Created on"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "SAML identity providers"
|
||||
end
|
||||
|
||||
context "with no SAML providers" do
|
||||
let(:saml_providers) { create_list(:saml_provider, 0) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "No SAML providers configured yet.", icon: :key
|
||||
end
|
||||
|
||||
context "with SAML providers" do
|
||||
let(:saml_providers) { create_list(:saml_provider, 2) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 4
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe My::TimeTracking::TimeEntriesListComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
subject(:rendered_component) do
|
||||
render_component(rows: time_entries)
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "Hours"
|
||||
include_examples "rendering Border Box Grid heading", text: "Subject"
|
||||
include_examples "rendering Border Box Grid heading", text: "Project"
|
||||
include_examples "rendering Border Box Grid heading", text: "Activity"
|
||||
include_examples "rendering Border Box Grid heading", text: "Comment"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "Time entries"
|
||||
end
|
||||
|
||||
context "with no time entries" do
|
||||
let(:time_entries) { create_list(:time_entry, 0) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "Nothing to display"
|
||||
end
|
||||
|
||||
context "with time entries" do
|
||||
let(:time_entries) { create_list(:time_entry, 2) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 5
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Meetings::TableComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
subject(:rendered_component) do
|
||||
render_component(rows: meetings)
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "Title"
|
||||
include_examples "rendering Border Box Grid heading", text: "Date and time"
|
||||
include_examples "rendering Border Box Grid heading", text: "Project"
|
||||
include_examples "rendering Border Box Grid heading", text: "Duration"
|
||||
include_examples "rendering Border Box Grid heading", text: "Location"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "Meetings"
|
||||
end
|
||||
|
||||
context "with no meetings" do
|
||||
let(:meetings) { create_list(:meeting, 0) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "No meetings to display"
|
||||
end
|
||||
|
||||
context "with meetings" do
|
||||
let(:meetings) { create_list(:meeting, 2) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 5
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,71 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe RecurringMeetings::TableComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
let(:recurring_meeting) { create(:recurring_meeting) }
|
||||
let(:meetings) { create_list(:scheduled_meeting, count, :persisted, recurring_meeting:) }
|
||||
|
||||
let(:current_project) { nil }
|
||||
let(:direction) { "upcoming" }
|
||||
let(:max_count) { 50 }
|
||||
|
||||
subject(:rendered_component) do
|
||||
render_component(recurring_meeting:, rows: meetings, current_project:, count:, direction:, max_count:)
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "Date and time"
|
||||
include_examples "rendering Border Box Grid heading", text: "Starts"
|
||||
include_examples "rendering Border Box Grid heading", text: "Status"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "Recurring meetings"
|
||||
end
|
||||
|
||||
context "with no recurring meetings" do
|
||||
let(:count) { 0 }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1, footer: true
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "Nothing to display"
|
||||
end
|
||||
|
||||
context "with recurring meetings" do
|
||||
let(:count) { 2 }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2, footer: true
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 4
|
||||
end
|
||||
end
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe OpenIDConnect::GroupLinks::TableComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
subject(:rendered_component) do
|
||||
render_component(rows: group_links)
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "OpenID group identifier"
|
||||
include_examples "rendering Border Box Grid heading", text: "Authentication provider"
|
||||
include_examples "rendering Border Box Grid heading", text: "Created on"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "Group link"
|
||||
end
|
||||
|
||||
context "with no group links" do
|
||||
let(:group_links) { create_list(:oidc_group_link, 0) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "Nothing to display"
|
||||
end
|
||||
|
||||
context "with group links" do
|
||||
let(:group_links) { create_list(:oidc_group_link, 2) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 3
|
||||
end
|
||||
end
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe OpenIDConnect::Providers::TableComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
subject(:rendered_component) do
|
||||
with_controller_class(OpenIDConnect::ProvidersController) do
|
||||
with_request_url("/admin/openid_connect/providers") do
|
||||
render_component(rows: providers)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "Name"
|
||||
include_examples "rendering Border Box Grid heading", text: "Type"
|
||||
include_examples "rendering Border Box Grid heading", text: "Users"
|
||||
include_examples "rendering Border Box Grid heading", text: "Created by"
|
||||
include_examples "rendering Border Box Grid heading", text: "Created on"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "Providers"
|
||||
end
|
||||
|
||||
context "with no providers" do
|
||||
let(:providers) { create_list(:oidc_provider, 0) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "No OpenID providers configured yet.", icon: :key
|
||||
end
|
||||
|
||||
context "with providers" do
|
||||
let(:providers) { create_list(:oidc_provider, 2) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 5
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,65 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Admin::ScimClients::TableComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
subject(:rendered_component) do
|
||||
render_component(rows: scim_clients)
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "Name"
|
||||
include_examples "rendering Border Box Grid heading", text: "Users"
|
||||
include_examples "rendering Border Box Grid heading", text: "Authentication method"
|
||||
include_examples "rendering Border Box Grid heading", text: "Created on"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "SCIM clients"
|
||||
end
|
||||
|
||||
context "with no SCIM clients" do
|
||||
let(:scim_clients) { create_list(:scim_client, 0) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "No SCIM clients configured yet", icon: :key
|
||||
end
|
||||
|
||||
context "with SCIM clients" do
|
||||
let(:scim_clients) { create_list(:scim_client, 2) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 4
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Admin::ScimClients::TokenTableComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
let(:scim_client) { create(:scim_client, :oauth2_token) }
|
||||
|
||||
subject(:rendered_component) do
|
||||
render_component(rows: access_tokens)
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "Created on"
|
||||
include_examples "rendering Border Box Grid heading", text: "Expires on"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "Access token table"
|
||||
end
|
||||
|
||||
context "with no access tokens" do
|
||||
let(:access_tokens) { [] }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "No tokens have been created yet"
|
||||
end
|
||||
|
||||
context "with access token" do
|
||||
let(:access_tokens) do
|
||||
[scim_client.oauth_application.access_tokens.create!(expires_in: 30),
|
||||
scim_client.oauth_application.access_tokens.create!(expires_in: 45)]
|
||||
end
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 2
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,64 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Groups::TableComponent, type: :component do
|
||||
def render_component(...)
|
||||
render_inline(described_class.new(...))
|
||||
end
|
||||
|
||||
subject(:rendered_component) do
|
||||
render_component(rows: groups)
|
||||
end
|
||||
|
||||
shared_examples_for "rendering Border Box Grid headings" do
|
||||
include_examples "rendering Border Box Grid heading", text: "Name"
|
||||
include_examples "rendering Border Box Grid heading", text: "User count"
|
||||
include_examples "rendering Border Box Grid heading", text: "Created on"
|
||||
include_examples "rendering Border Box Grid mobile heading", text: "Group"
|
||||
end
|
||||
|
||||
context "with no groups" do
|
||||
let(:groups) { create_list(:group, 0) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 1
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Blank Slate", heading: "No groups set up yet", icon: :people
|
||||
end
|
||||
|
||||
context "with groups" do
|
||||
let(:groups) { create_list(:group, 2) }
|
||||
|
||||
it_behaves_like "rendering Box", row_count: 2
|
||||
it_behaves_like "rendering Border Box Grid headings"
|
||||
it_behaves_like "rendering Border Box Grid rows", row_count: 2, col_count: 3
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,49 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
RSpec.shared_examples_for "rendering Blank Slate" do |heading:, icon: nil|
|
||||
it "renders Blank Slate container" do
|
||||
expect(rendered_component).to have_css ".blankslate-container"
|
||||
end
|
||||
|
||||
it "renders Blank Slate" do
|
||||
expect(rendered_component).to have_css ".blankslate"
|
||||
end
|
||||
|
||||
if icon
|
||||
it "renders Blank Slate icon" do
|
||||
expect(rendered_component).to have_octicon icon
|
||||
end
|
||||
end
|
||||
|
||||
it "renders Blank Slate heading" do
|
||||
expect(rendered_component).to have_heading heading, class: "blankslate-heading"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,55 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
RSpec.shared_examples_for "rendering Border Box Grid heading" do |text:|
|
||||
it "renders Border Box Grid heading '#{text}'" do
|
||||
expect(rendered_component).to have_css ".op-border-box-grid--heading", text:
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.shared_examples_for "rendering Border Box Grid mobile heading" do |text:|
|
||||
it "renders Border Box Grid mobile heading '#{text}'" do
|
||||
expect(rendered_component).to have_css ".op-border-box-grid--mobile-heading", text:
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.shared_examples_for "rendering Border Box Grid rows" do |row_count:, col_count:|
|
||||
it "renders list" do
|
||||
expect(rendered_component).to have_list
|
||||
end
|
||||
|
||||
it "renders list items", :aggregate_failures do
|
||||
expect(rendered_component).to have_list_item count: row_count, class: "Box-row"
|
||||
expect(rendered_component).to have_list_item class: "Box-row" do |list_item|
|
||||
expect(list_item).to have_css ".op-border-box-grid"
|
||||
expect(list_item).to have_css ".op-border-box-grid--row-item", count: col_count
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#-- copyright
|
||||
# OpenProject is an open source project management software.
|
||||
# Copyright (C) the OpenProject GmbH
|
||||
#
|
||||
# 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-2013 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 COPYRIGHT and LICENSE files for more details.
|
||||
#++
|
||||
|
||||
RSpec.shared_examples_for "rendering Box" do |row_count:, header: true, footer: false|
|
||||
it "renders Box" do
|
||||
expect(rendered_component).to have_css ".Box"
|
||||
end
|
||||
|
||||
if header
|
||||
it "renders Box header" do
|
||||
expect(rendered_component).to have_css ".Box-header"
|
||||
end
|
||||
end
|
||||
|
||||
it "renders #{row_count} Box rows" do
|
||||
expect(rendered_component).to have_css ".Box-row", count: row_count
|
||||
end
|
||||
|
||||
if footer
|
||||
it "renders Box footer" do
|
||||
expect(rendered_component).to have_css ".Box-footer"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user