From 9be9516478f446c2dc8c0ab3a7879df9bddd375f Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Sat, 3 Jan 2015 10:05:51 +0800 Subject: [PATCH 1/2] Remove unnecessary trailing period from Styleguide section in examples and tests. --- README.md | 6 +++--- SPEC.md | 8 ++++---- test/fixtures/css/buttons.css | 6 +++--- test/fixtures/less/buttons.less | 6 +++--- test/fixtures/less/mixins.less | 2 +- test/fixtures/sass/buttons.sass | 6 +++--- test/fixtures/scss/buttons.scss | 6 +++--- test/section_test.rb | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 81e0dd7..6992f89 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A button suitable for giving stars to someone. .stars-given:hover - Subtle hover highlight on top of stars-given styling. .disabled - Dims the button to indicate it cannot be used. -Styleguide 2.1.3. +Styleguide 2.1.3 */ a.button.star{ ... @@ -33,9 +33,9 @@ a.button.star.disabled{ KSS can also support words as Styleguide section names ```scss -// Styleguide Forms.Checkboxes. +// Styleguide Forms.Checkboxes // - or - -// Styleguide Forms - Special Checkboxes. +// Styleguide Forms - Special Checkboxes ``` ## Ruby Library [![Build Status](https://travis-ci.org/kneath/kss.png)](https://travis-ci.org/kneath/kss) [![Code Climate](https://codeclimate.com/github/kneath/kss.png)](https://codeclimate.com/github/kneath/kss) diff --git a/SPEC.md b/SPEC.md index 567f19c..3353d67 100644 --- a/SPEC.md +++ b/SPEC.md @@ -27,7 +27,7 @@ A button suitable for giving stars to someone. .stars-given:hover - Subtle hover highlight on top of stars-given styling. .disabled - Dims the button to indicate it cannot be used. -Styleguide 2.1.3. +Styleguide 2.1.3 */ a.button.star{ ... @@ -50,7 +50,7 @@ When using a preprocessor that supports the functionality, use `//` to prefix yo // .stars-given:hover - Subtle hover highlight on top of stars-given styling. // .disabled - Dims the button to indicate it cannot be used. // -// Styleguide 2.1.3. +// Styleguide 2.1.3 a.button.star{ ... &.star-given{ @@ -106,7 +106,7 @@ If the UI element you are documenting has multiple states or styles depending on If the UI element you are documenting has an example in the styleguide, you should reference it using the "Styleguide [ref]" syntax. ```scss -// Styleguide 2.1.3. +// Styleguide 2.1.3 ``` References can be integer sections separated by periods. Each period denotes a hierarchy of the styleguide. Styleguide references can point to entire sections, a portion of the section, or a specific example. @@ -114,7 +114,7 @@ References can be integer sections separated by periods. Each period denotes a h References may also be period seperated word keys. Leading words denote hierarchy. ```scss -// Styleguide Forms.Checkboxes. +// Styleguide Forms.Checkboxes ``` Finally, references may be more readable word phrases. diff --git a/test/fixtures/css/buttons.css b/test/fixtures/css/buttons.css index a76436f..c426a4d 100644 --- a/test/fixtures/css/buttons.css +++ b/test/fixtures/css/buttons.css @@ -6,7 +6,7 @@ Your standard form button. .primary - Indicates button is the primary action. .smaller - A little bit smaller now. -Styleguide 2.1.1. +Styleguide 2.1.1 */ button { padding: 5px 15px; } @@ -26,7 +26,7 @@ A button suitable for giving stars to someone. .star-given - A highlight indicating you've already given a star. .disabled - Dims the button to indicate it cannot be used. -Styleguide 2.2.1. +Styleguide 2.2.1 */ a.button.star { display: inline-block; } @@ -42,7 +42,7 @@ A big button .really-big - Even bigger button -Styleguide Buttons.Big. +Styleguide Buttons.Big */ a.button.big { display: inline-block; diff --git a/test/fixtures/less/buttons.less b/test/fixtures/less/buttons.less index ddb6920..9845321 100644 --- a/test/fixtures/less/buttons.less +++ b/test/fixtures/less/buttons.less @@ -6,7 +6,7 @@ Your standard form button. .primary - Indicates button is the primary action. .smaller - A little bit smaller now. -Styleguide 2.1.1. +Styleguide 2.1.1 */ button, .button { padding:5px 15px; @@ -34,7 +34,7 @@ A button suitable for giving stars to someone. .star-given - A highlight indicating you've already given a star. .disabled - Dims the button to indicate it cannot be used. -Styleguide 2.2.1. +Styleguide 2.2.1 */ a.button.star{ display:inline-block; @@ -55,7 +55,7 @@ A big button .really-big - Even bigger button -Styleguide Buttons.Big. +Styleguide Buttons.Big */ a.button.big { display: inline-block; diff --git a/test/fixtures/less/mixins.less b/test/fixtures/less/mixins.less index 87b5272..3a375c2 100644 --- a/test/fixtures/less/mixins.less +++ b/test/fixtures/less/mixins.less @@ -1,7 +1,7 @@ /* Your standard grid helper. -Styleguide 4.0.0. +Styleguide 4.0.0 */ .grid(@columns, @max: 10) { width: (@columns / @max) * 960px; diff --git a/test/fixtures/sass/buttons.sass b/test/fixtures/sass/buttons.sass index 1d9d24d..3220473 100644 --- a/test/fixtures/sass/buttons.sass +++ b/test/fixtures/sass/buttons.sass @@ -5,7 +5,7 @@ * .primary - Indicates button is the primary action. * .smaller - A little bit smaller now. * - * Styleguide 2.1.1. */ + * Styleguide 2.1.1 */ button padding: 5px 15px @@ -26,7 +26,7 @@ button // .star-given - A highlight indicating you've already given a star. // .disabled - Dims the button to indicate it cannot be used. // -// Styleguide 2.2.1. +// Styleguide 2.2.1 a.button.star display: inline-block @@ -43,7 +43,7 @@ a.button.star // // .really-big - A really big button // -// Styleguide Buttons.Big. +// Styleguide Buttons.Big a.button.big display: inline-block; font-size: 10em; diff --git a/test/fixtures/scss/buttons.scss b/test/fixtures/scss/buttons.scss index d7e2fb0..858a92c 100644 --- a/test/fixtures/scss/buttons.scss +++ b/test/fixtures/scss/buttons.scss @@ -5,7 +5,7 @@ // .primary - Indicates button is the primary action. // .smaller - A little bit smaller now. // -// Styleguide 2.1.1. +// Styleguide 2.1.1 button{ padding:5px 15px; @@ -31,7 +31,7 @@ button{ // .star-given - A highlight indicating you've already given a star. // .disabled - Dims the button to indicate it cannot be used. // -// Styleguide 2.2.1. +// Styleguide 2.2.1 a.button.star{ display:inline-block; @@ -50,7 +50,7 @@ a.button.star{ // // .really-big - Even bigger button // -// Styleguide Buttons.Big. +// Styleguide Buttons.Big a.button.big { display: inline-block; font-size: 10em; diff --git a/test/section_test.rb b/test/section_test.rb index 29e4138..dada6e6 100644 --- a/test/section_test.rb +++ b/test/section_test.rb @@ -13,7 +13,7 @@ def setup .primary - Indicates button is the primary action. .smaller - A smaller button -Styleguide 2.1.1. +Styleguide 2.1.1 comment @section = Kss::Section.new(@comment_text, 'example.css') From a8ec2186d060d19766516771f71f9da225856852 Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Sun, 4 Jan 2015 15:19:02 +0800 Subject: [PATCH 2/2] Add test for optional trailing period in Styleguide reference. --- test/fixtures/css/buttons.css | 8 ++++++++ test/parser_test.rb | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/test/fixtures/css/buttons.css b/test/fixtures/css/buttons.css index c426a4d..27654f2 100644 --- a/test/fixtures/css/buttons.css +++ b/test/fixtures/css/buttons.css @@ -37,6 +37,14 @@ a.button.star { a.button.star.disabled { opacity: 0.5; } +/* +Test that trailing period is stripped from the reference. + +Styleguide 2.2.2. +*/ +a.button.trailing:after { + content: '.'; } + /* A big button diff --git a/test/parser_test.rb b/test/parser_test.rb index 00b6a5b..1114c29 100644 --- a/test/parser_test.rb +++ b/test/parser_test.rb @@ -50,6 +50,11 @@ def setup @css_parsed.section('2.1.1').description end + test "parses KSS keys that have a trailing period" do + assert_equal 'Test that trailing period is stripped from the reference.', + @css_parsed.section('2.2.2').description + end + test "parses KSS keys that are words in CSS" do assert_equal 'A big button', @css_parsed.section('Buttons.Big').description @@ -76,7 +81,7 @@ def setup end test "public sections returns hash of sections" do - assert_equal 5, @css_parsed.sections.count + assert_equal 6, @css_parsed.sections.count end test "parse multiple paths" do