-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #382 from DFE-Digital/table-header-scopes
Add scope support for table headers
- Loading branch information
Showing
14 changed files
with
211 additions
and
47 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
app/components/govuk_component/table_component/body_component.html.erb
This file was deleted.
Oops, something went wrong.
14 changes: 13 additions & 1 deletion
14
app/components/govuk_component/table_component/body_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
app/components/govuk_component/table_component/head_component.html.erb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
app/components/govuk_component/table_component/row_component.html.erb
This file was deleted.
Oops, something went wrong.
39 changes: 35 additions & 4 deletions
39
app/components/govuk_component/table_component/row_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
spec/components/govuk_component/configuration/table_component_configuration_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require 'spec_helper' | ||
|
||
RSpec.describe(GovukComponent::TableComponent::CellComponent, type: :component) do | ||
let(:text) { 'Content' } | ||
let(:kwargs) { { text: text, header: true, parent: 'tbody' } } | ||
let(:component_css_class) { 'govuk-table__cell' } | ||
|
||
describe 'configuration' do | ||
describe 'disabling automatic scopes' do | ||
context "when enable_auto_table_scopes: true" do | ||
subject! { render_inline(GovukComponent::TableComponent::CellComponent.new(**kwargs)) } | ||
|
||
specify "renders a scopeless table cell" do | ||
expect(rendered_content).to have_tag("th", text: "Content") | ||
expect(html.at_css('th').attributes.keys).to match_array(%w(class scope)) | ||
end | ||
end | ||
|
||
context "when enable_auto_table_scopes: false" do | ||
after { Govuk::Components.reset! } | ||
|
||
before do | ||
Govuk::Components.configure do |config| | ||
config.enable_auto_table_scopes = false | ||
end | ||
end | ||
|
||
subject! { render_inline(GovukComponent::TableComponent::CellComponent.new(**kwargs)) } | ||
|
||
specify "renders a scopeless table cell" do | ||
expect(rendered_content).to have_tag("th", text: "Content") | ||
expect(html.at_css('th').attributes.keys).to match_array(%w(class)) | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.