backpack 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +2 -2
- data/README.md +11 -1
- data/bin/backpack +6 -0
- data/demo/Gemfile.lock +2 -1
- data/lib/backpack/cli.rb +39 -0
- data/lib/backpack/version.rb +1 -1
- data/lib/backpack.rb +2 -0
- data/spec/cli/import_spec.rb +51 -0
- data/spec/components/badge_spec.rb +2 -2
- data/spec/components/breadcrumb_spec.rb +9 -3
- data/spec/components/button_spec.rb +4 -4
- data/spec/components/favicon_spec.rb +4 -2
- data/spec/components/heading_spec.rb +2 -2
- data/spec/components/icon_button_spec.rb +2 -2
- data/spec/components/icon_spec.rb +2 -2
- data/spec/components/icon_sprite_spec.rb +2 -2
- data/spec/components/previews/badge_preview/overview.html.erb +5 -8
- data/spec/components/previews/button_preview/overview.html.erb +7 -12
- data/spec/components/previews/quotation_preview/overview.html.erb +4 -5
- data/spec/components/previews/rich_text_preview.rb +2 -0
- data/spec/components/quotation_spec.rb +6 -4
- data/spec/components/rich_text_spec.rb +2 -2
- data/spec/components/skip_links_spec.rb +10 -5
- data/spec/spec_helper.rb +1 -0
- data/spec/support/cli_helpers.rb +5 -0
- metadata +71 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f408e759a5f6ded65d78dcea7fc361c186230082e7dc82a7a4213d905206a159
|
|
4
|
+
data.tar.gz: fdbb02fcb38015cf8687ab2085f929acda73eaed25b516d3e093171b58be066b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03fb80e4313ac7d799a7c56711b25555fe41915c479d1cb8a2ffc7aaf7c856463a95fa6d854fd77c686ff4d296f912cd2863b102bdfe28adada02ef0e30ff0d6
|
|
7
|
+
data.tar.gz: 35862131f1a63f798b6caafb8ecc870f08d21d1477dff78c16fd92adb8a0080e582652dae7f126e700d9e1f1d29a4d5f711503e1f180cbb91859876c9e25f484
|
data/.gitlab-ci.yml
CHANGED
data/README.md
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
## Getting started
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
|
|
6
|
+
gem install backpack
|
|
7
|
+
backpack import
|
|
8
|
+
gem uninstall backpack
|
|
7
9
|
```
|
|
8
10
|
|
|
9
11
|
## Usage
|
|
@@ -24,6 +26,14 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
|
|
|
24
26
|
|
|
25
27
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
26
28
|
|
|
29
|
+
### Running the CLI
|
|
30
|
+
|
|
31
|
+
You can run the command line in development:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bundle exec bin/backpack
|
|
35
|
+
```
|
|
36
|
+
|
|
27
37
|
## Contributing
|
|
28
38
|
|
|
29
39
|
Bug reports and pull requests are welcome on GitHub at https://github.com/etaminstudio/backpack.
|
data/bin/backpack
ADDED
data/demo/Gemfile.lock
CHANGED
data/lib/backpack/cli.rb
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require "thor"
|
|
2
|
+
require "backpack"
|
|
3
|
+
|
|
4
|
+
module Backpack
|
|
5
|
+
class CLI < Thor
|
|
6
|
+
include Thor::Actions
|
|
7
|
+
|
|
8
|
+
desc "import", "Import Backpack in the current project"
|
|
9
|
+
|
|
10
|
+
source_root File.expand_path(__dir__)
|
|
11
|
+
|
|
12
|
+
def import
|
|
13
|
+
say ascii_art, :green
|
|
14
|
+
|
|
15
|
+
directory "stylesheets", "app/assets/stylesheets", recursive: true
|
|
16
|
+
directory "components", "app/components", recursive: true
|
|
17
|
+
|
|
18
|
+
copy_file "attributes.rb", "lib/backpack/attributes.rb"
|
|
19
|
+
copy_file "classes.rb", "lib/backpack/classes.rb"
|
|
20
|
+
copy_file "identifier.rb", "lib/backpack/identifier.rb"
|
|
21
|
+
copy_file "tokens.rb", "lib/backpack/tokens.rb"
|
|
22
|
+
|
|
23
|
+
directory "../../spec/components", "spec/components", recursive: true do |content|
|
|
24
|
+
content.gsub("require 'spec_helper'", "require 'rails_helper'")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def ascii_art
|
|
31
|
+
<<~ASCII
|
|
32
|
+
┌┐ ┌─┐┌─┐┬┌─┌─┐┌─┐┌─┐┬┌─
|
|
33
|
+
├┴┐├─┤│ ├┴┐├─┘├─┤│ ├┴┐
|
|
34
|
+
└─┘┴ ┴└─┘┴ ┴┴ ┴ ┴└─┘┴ ┴
|
|
35
|
+
|
|
36
|
+
ASCII
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/backpack/version.rb
CHANGED
data/lib/backpack.rb
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Backpack::CLI, type: :cli do
|
|
4
|
+
sandbox_dir = "sandbox"
|
|
5
|
+
|
|
6
|
+
around do |example|
|
|
7
|
+
FileUtils.mkdir(sandbox_dir) unless File.exist?(sandbox_dir)
|
|
8
|
+
within_dir(sandbox_dir) do
|
|
9
|
+
example.run
|
|
10
|
+
end
|
|
11
|
+
ensure
|
|
12
|
+
FileUtils.rm_rf(sandbox_dir)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe "import" do
|
|
16
|
+
let(:command) { `ruby ../bin/backpack import` }
|
|
17
|
+
let(:output) { command.chomp }
|
|
18
|
+
|
|
19
|
+
it "outputs ascii art and the list of created files" do
|
|
20
|
+
expect(output).to include(described_class.new.send(:ascii_art))
|
|
21
|
+
expect(output).to include("create app/assets/stylesheets/application.css")
|
|
22
|
+
expect(output).to include("create app/components/base.rb")
|
|
23
|
+
expect(output).to include("create app/components/button.rb")
|
|
24
|
+
expect(output).to include("create app/components/button/button.js")
|
|
25
|
+
expect(output).to include("create app/components/button/button.css")
|
|
26
|
+
expect(output).to include("create lib/backpack/attributes.rb")
|
|
27
|
+
expect(output).to include("create lib/backpack/classes.rb")
|
|
28
|
+
expect(output).to include("create lib/backpack/identifier.rb")
|
|
29
|
+
expect(output).to include("create lib/backpack/tokens.rb")
|
|
30
|
+
expect(output).to include("create spec/components/button_spec.rb")
|
|
31
|
+
expect(output).to include("create spec/components/previews/button_preview.rb")
|
|
32
|
+
expect(output).to include("create spec/components/previews/button_preview/overview.html.erb")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "copies the folders" do
|
|
36
|
+
command
|
|
37
|
+
expect(File.directory?("app/assets/stylesheets")).to be true
|
|
38
|
+
expect(File.directory?("app/components")).to be true
|
|
39
|
+
expect(File.directory?("spec/components")).to be true
|
|
40
|
+
expect(File.directory?("spec/components/previews")).to be true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "copies the lib files" do
|
|
44
|
+
command
|
|
45
|
+
expect(File.exist?("lib/backpack/attributes.rb")).to be true
|
|
46
|
+
expect(File.exist?("lib/backpack/classes.rb")).to be true
|
|
47
|
+
expect(File.exist?("lib/backpack/identifier.rb")).to be true
|
|
48
|
+
expect(File.exist?("lib/backpack/tokens.rb")).to be true
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::Badge, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) { text } }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
let(:text) { "Badge" }
|
|
7
9
|
|
|
8
|
-
subject(:output) { render_fragment(component) }
|
|
9
|
-
|
|
10
10
|
it "renders the element with the default styling" do
|
|
11
11
|
expect(output).to have_css(
|
|
12
12
|
".Badge.Badge-variant-solid", text:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::Breadcrumb, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
|
|
7
|
-
subject(:output) { render_fragment(component) }
|
|
8
|
-
|
|
9
9
|
context "without items" do
|
|
10
10
|
it "renders nothing" do
|
|
11
11
|
expect(output).to eq_html('')
|
|
@@ -25,9 +25,15 @@ describe Components::Breadcrumb, type: :component do
|
|
|
25
25
|
expect(output).to have_css("nav.Breadcrumb[role='navigation'][aria-label='Breadcrumb']")
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
it "renders
|
|
28
|
+
it "renders first item" do
|
|
29
29
|
expect(output).to have_css("li:nth-child(1) a[href='/']", text: "Home")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "renders second item" do
|
|
30
33
|
expect(output).to have_css("li:nth-child(2) a[href='/sections']", text: "Sections")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "renders third item" do
|
|
31
37
|
expect(output).to have_css("li:nth-child(3) a[href='']", text: "Articles")
|
|
32
38
|
end
|
|
33
39
|
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::Button, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) { text } }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
let(:text) { "Label" }
|
|
7
9
|
|
|
8
|
-
subject(:output) { render_fragment(component) }
|
|
9
|
-
|
|
10
10
|
it "renders a button element with the default styling" do
|
|
11
11
|
expect(output).to have_css(
|
|
12
12
|
"button.Button.Button-variant-solid.Button-size-2", text:
|
|
13
13
|
)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
it "doesn't render
|
|
17
|
-
expect(output).
|
|
16
|
+
it "doesn't render the icon" do
|
|
17
|
+
expect(output).not_to have_css("button.Button svg.Icon")
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
context "with a href" do
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::Favicon, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
# rubocop:disable RSpec/ExampleLength
|
|
9
10
|
it "renders the links" do
|
|
10
11
|
expect(output).to eq_html <<~HTML
|
|
11
12
|
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
|
|
@@ -15,6 +16,7 @@ describe Components::Favicon, type: :component do
|
|
|
15
16
|
<link rel="manifest" href="/site.webmanifest">
|
|
16
17
|
HTML
|
|
17
18
|
end
|
|
19
|
+
# rubocop:enable RSpec/ExampleLength
|
|
18
20
|
|
|
19
21
|
context "with application name" do
|
|
20
22
|
let(:params) { { application_name: "My App" } }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::Heading, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) { text } }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
let(:text) { "Heading" }
|
|
7
9
|
|
|
8
|
-
subject(:output) { render_fragment(component) }
|
|
9
|
-
|
|
10
10
|
it "renders a level 1 heading by default" do
|
|
11
11
|
expect(output).to have_css("h1.Heading.Heading-1", text:)
|
|
12
12
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::IconButton, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) }
|
|
5
7
|
let(:params) { { icon: :user, label: "User" } }
|
|
6
8
|
|
|
7
|
-
subject(:output) { render_fragment(component) }
|
|
8
|
-
|
|
9
9
|
it "renders a button element with the default styling" do
|
|
10
10
|
expect(output).to have_css(
|
|
11
11
|
"button.IconButton.IconButton-variant-solid.IconButton-size-2"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::Icon, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(key, **params) }
|
|
5
7
|
let(:key) { nil }
|
|
6
8
|
let(:params) { {} }
|
|
7
9
|
|
|
8
|
-
subject(:output) { render_fragment(component) }
|
|
9
|
-
|
|
10
10
|
context "with symbol key" do
|
|
11
11
|
let(:key) { :user }
|
|
12
12
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::IconSprite, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
|
|
7
|
-
subject(:output) { render_fragment(component) }
|
|
8
|
-
|
|
9
9
|
context "without Current" do
|
|
10
10
|
it "renders nothing" do
|
|
11
11
|
expect(output).to eq_html('')
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
1
|
+
<%
|
|
2
|
+
props = Components::Badge.literal_properties
|
|
3
|
+
%>
|
|
3
4
|
<table class="lookbook-table">
|
|
4
5
|
<thead>
|
|
5
6
|
<tr>
|
|
6
7
|
<th>Color</th>
|
|
7
8
|
<% props[:color].type.each do |color| %>
|
|
8
|
-
<th colspan="<%= props[:size].type.to_a.size %>">
|
|
9
|
-
<code><%= color || :default %></code>
|
|
10
|
-
</th>
|
|
9
|
+
<th colspan="<%= props[:size].type.to_a.size %>"><code><%= color || :default %></code></th>
|
|
11
10
|
<% end %>
|
|
12
11
|
</tr>
|
|
13
12
|
<tr>
|
|
@@ -25,9 +24,7 @@
|
|
|
25
24
|
<th><code><%= variant %></code></th>
|
|
26
25
|
<% props[:color].type.each do |color| %>
|
|
27
26
|
<% props[:size].type.each do |size| %>
|
|
28
|
-
<td>
|
|
29
|
-
<%= render Components::Badge.new(variant:, size:, color:) { "Badge" } %>
|
|
30
|
-
</td>
|
|
27
|
+
<td><%= render Components::Badge.new(variant:, size:, color:) { "Badge" } %></td>
|
|
31
28
|
<% end %>
|
|
32
29
|
<% end %>
|
|
33
30
|
</tr>
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<%
|
|
2
|
+
props = Components::Button.literal_properties
|
|
3
|
+
icon = "arrow-right"
|
|
4
|
+
%>
|
|
4
5
|
<table class="lookbook-table">
|
|
5
6
|
<thead>
|
|
6
7
|
<tr>
|
|
7
8
|
<th>Color</th>
|
|
8
9
|
<% props[:color].type.each do |color| %>
|
|
9
|
-
<th colspan="<%= props[:size].type.to_a.size %>">
|
|
10
|
-
<code><%= color || :default %></code>
|
|
11
|
-
</th>
|
|
10
|
+
<th colspan="<%= props[:size].type.to_a.size %>"><code><%= color || :default %></code></th>
|
|
12
11
|
<% end %>
|
|
13
12
|
</tr>
|
|
14
13
|
<tr>
|
|
@@ -26,9 +25,7 @@ icon = "arrow-right" %>
|
|
|
26
25
|
<th><code><%= variant %></code></th>
|
|
27
26
|
<% props[:color].type.each do |color| %>
|
|
28
27
|
<% props[:size].type.each do |size| %>
|
|
29
|
-
<td>
|
|
30
|
-
<%= render Components::Button.new(variant:, size:, color:, icon:) { "Button" } %>
|
|
31
|
-
</td>
|
|
28
|
+
<td><%= render Components::Button.new(variant:, size:, color:, icon:) { "Button" } %></td>
|
|
32
29
|
<% end %>
|
|
33
30
|
<% end %>
|
|
34
31
|
</tr>
|
|
@@ -36,9 +33,7 @@ icon = "arrow-right" %>
|
|
|
36
33
|
<th><code><%= variant %></code>, <code>disabled</code></th>
|
|
37
34
|
<% props[:color].type.each do |color| %>
|
|
38
35
|
<% props[:size].type.each do |size| %>
|
|
39
|
-
<td>
|
|
40
|
-
<%= render Components::Button.new(variant:, size:, color:, icon:, disabled: true) { "Button" } %>
|
|
41
|
-
</td>
|
|
36
|
+
<td><%= render Components::Button.new(variant:, size:, color:, icon:, disabled: true) { "Button" } %></td>
|
|
42
37
|
<% end %>
|
|
43
38
|
<% end %>
|
|
44
39
|
</tr>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
1
|
+
<%
|
|
2
|
+
props = Components::Quotation.literal_properties
|
|
3
|
+
%>
|
|
3
4
|
<table class="lookbook-table">
|
|
4
5
|
<thead>
|
|
5
6
|
<tr>
|
|
@@ -14,9 +15,7 @@
|
|
|
14
15
|
<tr>
|
|
15
16
|
<th><code><%= size %></code></th>
|
|
16
17
|
<% props[:weight].type.each do |weight| %>
|
|
17
|
-
<td>
|
|
18
|
-
<%= render Components::Quotation.new(size:, weight:, cite: "Jan Tschichold") { "Perfect typography is certainly the most elusive of all arts. Sculpture in stone alone comes near it in obstinacy." } %>
|
|
19
|
-
</td>
|
|
18
|
+
<td><%= render Components::Quotation.new(size:, weight:, cite: "Jan Tschichold") { "Perfect typography is certainly the most elusive of all arts. Sculpture in stone alone comes near it in obstinacy." } %></td>
|
|
20
19
|
<% end %>
|
|
21
20
|
</tr>
|
|
22
21
|
<% end %>
|
|
@@ -2,6 +2,7 @@ class RichTextPreview < Lookbook::Preview
|
|
|
2
2
|
include Components
|
|
3
3
|
|
|
4
4
|
# Content comes from [Chris Coyer's HTML Kitchen-sink](https://codepen.io/chriscoyier/pen/JpLzjd)
|
|
5
|
+
# rubocop:disable Rails/OutputSafety
|
|
5
6
|
def default
|
|
6
7
|
RichText() do
|
|
7
8
|
<<~HTML.html_safe
|
|
@@ -98,4 +99,5 @@ class RichTextPreview < Lookbook::Preview
|
|
|
98
99
|
HTML
|
|
99
100
|
end
|
|
100
101
|
end
|
|
102
|
+
# rubocop:enable Rails/OutputSafety
|
|
101
103
|
end
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::Quotation, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) { html } }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
let(:text) do
|
|
7
9
|
"Perfect typography is certainly the most elusive of all arts. Sculpture in stone alone comes near it in obstinacy."
|
|
8
10
|
end
|
|
9
11
|
let(:html) do
|
|
12
|
+
# rubocop:disable Rails/OutputSafety
|
|
10
13
|
"<p>#{text}</p>".html_safe
|
|
14
|
+
# rubocop:enable Rails/OutputSafety
|
|
11
15
|
end
|
|
12
16
|
|
|
13
|
-
subject(:output) { render_fragment(component) }
|
|
14
|
-
|
|
15
17
|
it "renders a blockquote element" do
|
|
16
18
|
expect(output).to have_css("blockquote.Quotation.Quotation-size-2",
|
|
17
19
|
text:)
|
|
@@ -22,8 +24,8 @@ describe Components::Quotation, type: :component do
|
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
it "doesn't render a footer not a cite element" do
|
|
25
|
-
expect(output).
|
|
26
|
-
expect(output).
|
|
27
|
+
expect(output).not_to have_css("blockquote.Quotation footer")
|
|
28
|
+
expect(output).not_to have_css("blockquote.Quotation cite")
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
context "with a cite" do
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Components::RichText, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) { html } }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
let(:html) { "<h1>Hello</h2> <p>World</p>".html_safe }
|
|
7
9
|
|
|
8
|
-
subject(:output) { render_fragment(component) }
|
|
9
|
-
|
|
10
10
|
it "wraps content in a div with the default class" do
|
|
11
11
|
expect(output).to have_css("div.RichText", text: "Hello World")
|
|
12
12
|
end
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe Components::SkipLinks, type: :component do
|
|
3
|
+
RSpec.describe Components::SkipLinks, type: :component do
|
|
4
|
+
subject(:output) { render_fragment(component) }
|
|
5
|
+
|
|
4
6
|
let(:component) { described_class.new(**params) }
|
|
5
7
|
let(:params) { {} }
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
it "renders the skip links list" do
|
|
10
|
-
expect(output).to have_css("ul.SkipLinks")
|
|
9
|
+
it "renders 2 items" do
|
|
11
10
|
expect(output).to have_css("ul.SkipLinks > li", count: 2)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "renders the first link" do
|
|
12
14
|
expect(output).to have_css(
|
|
13
15
|
"ul.SkipLinks > li:nth-child(1) > a[href='#content']",
|
|
14
16
|
text: "Aller au contenu"
|
|
15
17
|
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "renders the second link" do
|
|
16
21
|
expect(output).to have_css(
|
|
17
22
|
"ul.SkipLinks > li:nth-child(2) > a[href='#navigation']",
|
|
18
23
|
text: "Aller à la navigation"
|
data/spec/spec_helper.rb
CHANGED
|
@@ -13,6 +13,7 @@ RSpec.configure do |config|
|
|
|
13
13
|
c.syntax = :expect
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
config.include CLIHelpers, type: :cli
|
|
16
17
|
config.include ComponentSpecHelpers, type: :component
|
|
17
18
|
config.include Capybara::RSpecMatchers, type: :component
|
|
18
19
|
config.include RSpecHtmlMatchers, type: :component
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: backpack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lucas Heymès
|
|
8
8
|
- Hans Lemuet
|
|
9
9
|
- Hugo Chantelauze
|
|
10
|
-
bindir:
|
|
10
|
+
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
@@ -67,9 +67,38 @@ dependencies:
|
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
69
|
version: '0'
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: thor
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
type: :runtime
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0'
|
|
84
|
+
- !ruby/object:Gem::Dependency
|
|
85
|
+
name: rspec
|
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ">="
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '0'
|
|
91
|
+
type: :development
|
|
92
|
+
prerelease: false
|
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - ">="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '0'
|
|
70
98
|
email:
|
|
71
99
|
- team@etamin.studio
|
|
72
|
-
executables:
|
|
100
|
+
executables:
|
|
101
|
+
- backpack
|
|
73
102
|
extensions: []
|
|
74
103
|
extra_rdoc_files: []
|
|
75
104
|
files:
|
|
@@ -80,6 +109,7 @@ files:
|
|
|
80
109
|
- LICENSE
|
|
81
110
|
- README.md
|
|
82
111
|
- Rakefile
|
|
112
|
+
- bin/backpack
|
|
83
113
|
- demo/.gitignore
|
|
84
114
|
- demo/.overmind.env
|
|
85
115
|
- demo/.yarn/cache/@babel-code-frame-npm-7.27.1-4dbcabb137-5874edc5d3.zip
|
|
@@ -573,6 +603,7 @@ files:
|
|
|
573
603
|
- lib/backpack.rb
|
|
574
604
|
- lib/backpack/attributes.rb
|
|
575
605
|
- lib/backpack/classes.rb
|
|
606
|
+
- lib/backpack/cli.rb
|
|
576
607
|
- lib/backpack/components.rb
|
|
577
608
|
- lib/backpack/components/badge.rb
|
|
578
609
|
- lib/backpack/components/badge/badge.css
|
|
@@ -617,6 +648,7 @@ files:
|
|
|
617
648
|
- lib/backpack/stylesheets/utilities/_sr-only.css
|
|
618
649
|
- lib/backpack/tokens.rb
|
|
619
650
|
- lib/backpack/version.rb
|
|
651
|
+
- spec/cli/import_spec.rb
|
|
620
652
|
- spec/components/badge_spec.rb
|
|
621
653
|
- spec/components/breadcrumb_spec.rb
|
|
622
654
|
- spec/components/button_spec.rb
|
|
@@ -645,6 +677,7 @@ files:
|
|
|
645
677
|
- spec/fixtures/icons/close.svg
|
|
646
678
|
- spec/fixtures/icons/user.svg
|
|
647
679
|
- spec/spec_helper.rb
|
|
680
|
+
- spec/support/cli_helpers.rb
|
|
648
681
|
- spec/support/components.rb
|
|
649
682
|
- spec/support/matchers/eq_html.rb
|
|
650
683
|
- spec/support/matchers/include_html.rb
|
|
@@ -671,4 +704,38 @@ requirements: []
|
|
|
671
704
|
rubygems_version: 3.7.2
|
|
672
705
|
specification_version: 4
|
|
673
706
|
summary: When you go on a trek, don't forget your backpack.
|
|
674
|
-
test_files:
|
|
707
|
+
test_files:
|
|
708
|
+
- spec/cli/import_spec.rb
|
|
709
|
+
- spec/components/badge_spec.rb
|
|
710
|
+
- spec/components/breadcrumb_spec.rb
|
|
711
|
+
- spec/components/button_spec.rb
|
|
712
|
+
- spec/components/favicon_spec.rb
|
|
713
|
+
- spec/components/heading_spec.rb
|
|
714
|
+
- spec/components/icon_button_spec.rb
|
|
715
|
+
- spec/components/icon_spec.rb
|
|
716
|
+
- spec/components/icon_sprite_spec.rb
|
|
717
|
+
- spec/components/previews/badge_preview.rb
|
|
718
|
+
- spec/components/previews/badge_preview/overview.html.erb
|
|
719
|
+
- spec/components/previews/breadcrumb_preview.rb
|
|
720
|
+
- spec/components/previews/button_preview.rb
|
|
721
|
+
- spec/components/previews/button_preview/overview.html.erb
|
|
722
|
+
- spec/components/previews/heading_preview.rb
|
|
723
|
+
- spec/components/previews/icon_button_preview.rb
|
|
724
|
+
- spec/components/previews/icon_button_preview/overview.html.erb
|
|
725
|
+
- spec/components/previews/icon_preview.rb
|
|
726
|
+
- spec/components/previews/quotation_preview.rb
|
|
727
|
+
- spec/components/previews/quotation_preview/overview.html.erb
|
|
728
|
+
- spec/components/previews/rich_text_preview.rb
|
|
729
|
+
- spec/components/previews/skip_links_preview.rb
|
|
730
|
+
- spec/components/quotation_spec.rb
|
|
731
|
+
- spec/components/rich_text_spec.rb
|
|
732
|
+
- spec/components/skip_links_spec.rb
|
|
733
|
+
- spec/fixtures/icons/arrow-right.svg
|
|
734
|
+
- spec/fixtures/icons/close.svg
|
|
735
|
+
- spec/fixtures/icons/user.svg
|
|
736
|
+
- spec/spec_helper.rb
|
|
737
|
+
- spec/support/cli_helpers.rb
|
|
738
|
+
- spec/support/components.rb
|
|
739
|
+
- spec/support/matchers/eq_html.rb
|
|
740
|
+
- spec/support/matchers/include_html.rb
|
|
741
|
+
- spec/support/spec_helpers.rb
|