Skip to content

Commit

Permalink
fix:component spec
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdom-plus committed Jun 27, 2024
1 parent c68a542 commit 65393da
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 28 deletions.
2 changes: 1 addition & 1 deletion rails/app/components/breadcrumb/component.html.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.ui.grid
.ui.grid#breadcrumb
.column
- breadcrumb @path, @model
= breadcrumbs separator: " > " ,class: 'ui breadcrumb top-padding', fragment_class: 'section', current_class: 'active'
2 changes: 1 addition & 1 deletion rails/app/components/close_rail/component.html.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.ui.right.close.rail
.ui.right.close.rail#close-rail
.ui.sticky
.ui.labeled.icon.teal.button#top-button data-action='click->sidebar#top'
i.up.arrow.icon
Expand Down
13 changes: 4 additions & 9 deletions rails/spec/components/breadcrumb_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
require 'rails_helper'

RSpec.describe Breadcrumb, type: :component do
pending "add some examples to (or delete) #{__FILE__}"

# it "renders something useful" do
# expect(
# render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html
# ).to include(
# "Hello, components!"
# )
# end
it 'renders a breadcrumb' do
render_inline(Breadcrumb::Component.new(path: :root))
expect(page).to have_css('#breadcrumb')
end
end
13 changes: 4 additions & 9 deletions rails/spec/components/close_rail_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
require 'rails_helper'

RSpec.describe CloseRail, type: :component do
pending "add some examples to (or delete) #{__FILE__}"

# it "renders something useful" do
# expect(
# render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html
# ).to include(
# "Hello, components!"
# )
# end
it 'renders a close rail' do
render_inline(CloseRail::Component.new)
expect(page).to have_css('#close-rail')
end
end
18 changes: 10 additions & 8 deletions rails/spec/components/flash_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
require 'rails_helper'

RSpec.describe Flash, type: :component do
pending "add some examples to (or delete) #{__FILE__}"
it 'renders a flash message(notice)' do
render_inline(Flash::Component.new(flash: { notice: 'notice' }))
expect(page).to have_css('#message')
expect(page).to have_css('.positive')
end

# it "renders something useful" do
# expect(
# render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html
# ).to include(
# "Hello, components!"
# )
# end
it 'renders a flash message(alert)' do
render_inline(Flash::Component.new(flash: { alert: 'alert' }))
expect(page).to have_css('#message')
expect(page).to have_css('.negative')
end
end

0 comments on commit 65393da

Please sign in to comment.