Skip to content

Commit

Permalink
Bug Fix: Fixing bad CSS in action-list.css and writing test to check …
Browse files Browse the repository at this point in the history
…for error (#1539)
  • Loading branch information
jonrohan authored Oct 25, 2022
1 parent 1d0243c commit c86d478
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-bees-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Bug Fix: Fixing bad CSS in action-list.css and writing test to check for error
1 change: 1 addition & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"no-descending-specificity": null,
"declaration-block-no-redundant-longhand-properties": null,
"color-function-notation": "legacy",
"selector-nested-pattern": "^&\\s?\\W",
"at-rule-no-unknown": [
true,
{
Expand Down
8 changes: 4 additions & 4 deletions app/components/primer/alpha/action_list/action-list.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
/* hide divider if item is active */
& .ActionListItem--navActive {
& .ActionListItem-label::before,
+ .ActionListItem .ActionListItem-label::before {
& + .ActionListItem .ActionListItem-label::before {
visibility: hidden;
}
}
Expand Down Expand Up @@ -196,7 +196,7 @@

&.ActionListItem--navActive {
&:not(.ActionListItem--subItem) {
.ActionListItem-label {
& .ActionListItem-label {
font-weight: var(--base-text-weight-semibold, 600);
}
}
Expand Down Expand Up @@ -406,7 +406,7 @@
}

&::before,
+ .ActionListItem::before {
& + .ActionListItem::before {
visibility: hidden;
}

Expand Down Expand Up @@ -579,7 +579,7 @@
border: 0;
}

.ActionList-sectionDivider-title {
& .ActionList-sectionDivider-title {
font-size: var(--primer-text-body-size-small, 12px);
font-weight: var(--base-text-weight-semibold, 600);
color: var(--color-fg-muted);
Expand Down
8 changes: 4 additions & 4 deletions app/components/primer/beta/button.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ summary.Button {
padding: 0 var(--primer-control-small-paddingInline-condensed, 8px);
gap: var(--primer-control-small-gap, 4px);

.Button-label {
& .Button-label {
line-height: var(--primer-text-body-lineHeight-small, calc(20 / 12));
}

.Button-content {
& .Button-content {
& > :not(:last-child) {
margin-right: var(--primer-control-small-gap, 4px);
}
Expand All @@ -143,11 +143,11 @@ summary.Button {
padding: 0 var(--primer-control-large-paddingInline-spacious, 16px);
gap: var(--primer-control-large-gap, 8px);

.Button-label {
& .Button-label {
line-height: var(--primer-text-body-lineHeight-large, calc(48 / 32));
}

.Button-content {
& .Button-content {
& > :not(:last-child) {
margin-right: var(--primer-control-large-gap, 8px);
}
Expand Down
20 changes: 20 additions & 0 deletions test/components/component_css_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

require "components/test_helper"

class ComponentCssTest < Minitest::Test
include Primer::ComponentTestHelpers

def test_css_gets_compiled
assert File.exist?("app/assets/styles/primer_view_components.css"), "Compiled CSS file not found"
end

def test_css_is_compiled_correctly
Dir["app/components/**/*.css"].each do |file|
css = File.read(file)

refute(css.include?("@import"), "CSS files should not import other CSS files:\n#{file} contains @import")
refute(css.include?("&"), "CSS Nesting wasn't compiled correctly:\n#{file} contains &")
end
end
end

0 comments on commit c86d478

Please sign in to comment.