-
- Notifications
You must be signed in to change notification settings - Fork 43
Added dfn tag #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added dfn tag #235
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| %dfn{@tag_attributes} | ||
| - if options[:text].nil? && block_given? | ||
| = yield | ||
| - else | ||
| = options[:text] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module Matestack::Ui::Core::Dfn | ||
| class Dfn < Matestack::Ui::Core::Component::Static | ||
| | ||
| end | ||
| end | ||
| |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| %u{@tag_attributes} | ||
| - if options[:text].nil? && block_given? | ||
| = yield | ||
| - else | ||
| = options[:text] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module Matestack::Ui::Core::U | ||
| class U < Matestack::Ui::Core::Component::Static | ||
| | ||
| end | ||
| end | ||
| |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # matestack core component: Hr | ||
| | ||
| Show [specs](/spec/usage/components/dfn_spec.rb) | ||
| | ||
| The HTML `<dfn>` tag implemented in ruby. | ||
| | ||
| ## Parameters | ||
| | ||
| This component can take 2 optional configuration params. | ||
| | ||
| #### # id (optional) | ||
| Expects a string with all ids the dfn should have. | ||
| | ||
| #### # class (optional) | ||
| Expects a string with all classes the dfn should have. | ||
| | ||
| ## Example 1 | ||
| Adding an optional id | ||
| | ||
| ```ruby | ||
| div id: "foo", class: "bar" do | ||
| dfn id: "dfn-id" | ||
| end | ||
| ``` | ||
| | ||
| returns | ||
| | ||
| ```html | ||
| <div id="foo" class="bar"> | ||
| <dfn id="dfn-id"> | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing closing tag | ||
| </div> | ||
| ``` | ||
| | ||
| ## Example 2 | ||
| Adding an optional class | ||
| | ||
| ```ruby | ||
| div id: "foo", class: "bar" do | ||
| dfn class: "dfn-class" | ||
| end | ||
| ``` | ||
| | ||
| returns | ||
| | ||
| ```html | ||
| <div id="foo" class="bar"> | ||
| <dfn class="dfn-class"> | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing closing tag | ||
| </div> | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # matestack core component: Hr | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. U, not Hr | ||
| | ||
| Show [specs](/spec/usage/components/hr_spec.rb) | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same | ||
| | ||
| The HTML `<u>` tag implemented in ruby. | ||
| | ||
| ## Parameters | ||
| | ||
| This component can take 2 optional configuration params. | ||
| | ||
| #### # id (optional) | ||
| Expects a string with all ids the u should have. | ||
| | ||
| #### # class (optional) | ||
| Expects a string with all classes the u should have. | ||
| | ||
| ## Example 1 | ||
| Adding an optional id | ||
| | ||
| ```ruby | ||
| div id: "foo", class: "bar" do | ||
| u id: "u-id" | ||
| end | ||
| ``` | ||
| | ||
| returns | ||
| | ||
| ```html | ||
| <div id="foo" class="bar"> | ||
| <u id="u-id"> | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing closing tag | ||
| </div> | ||
| ``` | ||
| | ||
| ## Example 2 | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide one example using the Just like in the | ||
| Adding an optional class | ||
| | ||
| ```ruby | ||
| div id: "foo", class: "bar" do | ||
| u class: "u-class" | ||
| end | ||
| ``` | ||
| | ||
| returns | ||
| | ||
| ```html | ||
| <div id="foo" class="bar"> | ||
| <u class="u-class"> | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing | ||
| </div> | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| require_relative "../../support/utils" | ||
| include Utils | ||
| | ||
| describe 'dfn Component', type: :feature, js: true do | ||
| | ||
| it 'Example 1 - yield, no options[:text]' do | ||
| | ||
| class ExamplePage < Matestack::Ui::Page | ||
| | ||
| def response | ||
| components { | ||
| # simple dfn | ||
| dfn do | ||
| plain 'I am simple' | ||
| end | ||
| | ||
| # enhanced dfn | ||
| dfn id: 'my-id', class: 'my-class' do | ||
| plain 'I am enhanced' | ||
| end | ||
| } | ||
| end | ||
| | ||
| end | ||
| | ||
| visit '/example' | ||
| | ||
| static_output = page.html | ||
| | ||
| expected_static_output = <<~HTML | ||
| <dfn>I am simple</dfn> | ||
| <dfn id="my-id" class="my-class">I am enhanced</dfn> | ||
| HTML | ||
| | ||
| expect(stripped(static_output)).to include(stripped(expected_static_output)) | ||
| end | ||
| | ||
| it 'Example 2 - render options[:text]' do | ||
| | ||
| class ExamplePage < Matestack::Ui::Page | ||
| | ||
| def response | ||
| components { | ||
| # simple dfn | ||
| dfn text: 'I am simple' | ||
| | ||
| # enhanced dfn | ||
| dfn id: 'my-id', class: 'my-class', text: 'I am enhanced' | ||
| } | ||
| end | ||
| | ||
| end | ||
| | ||
| visit '/example' | ||
| | ||
| static_output = page.html | ||
| | ||
| expected_static_output = <<~HTML | ||
| <dfn>I am simple</dfn> | ||
| <dfn id="my-id" class="my-class">I am enhanced</dfn> | ||
| HTML | ||
| | ||
| expect(stripped(static_output)).to include(stripped(expected_static_output)) | ||
| end | ||
| | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| require_relative "../../support/utils" | ||
| include Utils | ||
| | ||
| describe 'u Component', type: :feature, js: true do | ||
| | ||
| it 'Example 1 - yield, no options[:text]' do | ||
| | ||
| class ExamplePage < Matestack::Ui::Page | ||
| | ||
| def response | ||
| components { | ||
| # simple u | ||
| u do | ||
| plain 'I am simple' | ||
| end | ||
| | ||
| # enhanced u | ||
| u id: 'my-id', class: 'my-class' do | ||
| plain 'I am enhanced' | ||
| end | ||
| } | ||
| end | ||
| | ||
| end | ||
| | ||
| visit '/example' | ||
| | ||
| static_output = page.html | ||
| | ||
| expected_static_output = <<~HTML | ||
| <u>I am simple</u> | ||
| <u id="my-id" class="my-class">I am enhanced</u> | ||
| HTML | ||
| | ||
| expect(stripped(static_output)).to include(stripped(expected_static_output)) | ||
| end | ||
| | ||
| it 'Example 2 - render options[:text]' do | ||
| | ||
| class ExamplePage < Matestack::Ui::Page | ||
| | ||
| def response | ||
| components { | ||
| # simple u | ||
| u text: 'I am simple' | ||
| | ||
| # enhanced u | ||
| u id: 'my-id', class: 'my-class', text: 'I am enhanced' | ||
| } | ||
| end | ||
| | ||
| end | ||
| | ||
| visit '/example' | ||
| | ||
| static_output = page.html | ||
| | ||
| expected_static_output = <<~HTML | ||
| <u>I am simple</u> | ||
| <u id="my-id" class="my-class">I am enhanced</u> | ||
| HTML | ||
| | ||
| expect(stripped(static_output)).to include(stripped(expected_static_output)) | ||
| end | ||
| | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dfn, not Hr