-
-
Notifications
You must be signed in to change notification settings - Fork 43
Fix issue #208: Add HTML <q> tag to core components #212
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
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
**Please make sure to target feature and bugfix requests to develop branch** | ||
|
||
## Issue https://github.com/basemate/matestack-ui-core/issues/XXX: Short description here | ||
## Issue https://github.com/basemate/matestack-ui-core/issues/208: Add HTML <q> tag to core components | ||
|
||
### Changes | ||
|
||
- [x] Describe the changes in one or more bulletpoints | ||
- Created q folder, q.haml and q.rb files to matestack ui core components | ||
- Created q.md to docs > components | ||
- Created q_spec.rb to usage > components | ||
|
||
### Notes | ||
|
||
- Let the reviewers know something special | ||
- Nothing here |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
%q{@tag_attributes} | ||
- if block_given? | ||
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. I would love this component to have a |
||
= yield |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Matestack::Ui::Core::Q | ||
class Q < Matestack::Ui::Core::Component::Static | ||
|
||
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. Here, you probably need to merge the 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. OK, got you. |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# matestack core component: Q | ||
|
||
Show [specs](../../spec/usage/components/q_spec.rb) | ||
|
||
The HTML q tag implemented in ruby. | ||
|
||
## Parameters | ||
|
||
This component can take 2 optional configuration params and either yield content or display what gets passed to the `text` configuration param. | ||
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. Again, the |
||
|
||
#### # id (optional) | ||
Expects a string with all ids the q should have. | ||
|
||
#### # class (optional) | ||
Expects a string with all classes the q should have. | ||
|
||
#### # text (optional) | ||
Expects a string with the text that should go into the `<q>` tag. | ||
|
||
## Example 1: Yield a given block | ||
|
||
```ruby | ||
q id: "foo", class: "bar" do | ||
plain 'Hello World' # optional content | ||
end | ||
``` | ||
|
||
returns | ||
|
||
```html | ||
<q id="foo" class="bar"> | ||
Hello World | ||
</q> | ||
``` | ||
|
||
## Example 2: Render options[:text] param | ||
|
||
```ruby | ||
q id: "foo", class: "bar", text: 'Hello World' | ||
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. This example is not tested and for now probably wouldn't work! |
||
``` | ||
|
||
returns | ||
|
||
```html | ||
<q id="foo" class="bar"> | ||
Hello World | ||
</q> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require_relative "../../support/utils" | ||
include Utils | ||
|
||
describe "Q Component", type: :feature, js: true do | ||
|
||
it "Example 1" do | ||
|
||
class ExamplePage < Matestack::Ui::Page | ||
|
||
def response | ||
components { | ||
#simple q | ||
q | ||
|
||
#simple q with attributes | ||
q id: "my-id", class: "my-class" | ||
|
||
#nested q | ||
q do | ||
q id: "my-nested-q" | ||
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 test the |
||
end | ||
} | ||
end | ||
|
||
end | ||
|
||
visit "/example" | ||
|
||
static_output = page.html | ||
|
||
expected_static_output = <<~HTML | ||
<q></q> | ||
|
||
<q id="my-id" class="my-class"></q> | ||
|
||
<q> | ||
<q id="my-nested-q"></q> | ||
</q> | ||
HTML | ||
|
||
expect(stripped(static_output)).to include(stripped(expected_static_output)) | ||
end | ||
|
||
end |
Uh oh!
There was an error while loading. Please reload this page.