Sha256: d6ad26fa99740f733db3f040cdb225408a93b9d917b312efb3551c6c6f9560b8
Contents?: true
Size: 1.93 KB
Versions: 3
Compression:
Stored size: 1.93 KB
Contents
require 'spec_helper' describe 'Navigasmic::Builder::ListBuilder', type: :helper do subject { Navigasmic::Builder::ListBuilder } def clean(string) string.gsub(/\n(\s+)|\n|^\s+/, '') end describe "rendering" do it "outputs basic example" do builder = subject.new helper, :primary, {} do |n| n.group(class: 'group') { n.item "Label", '/path' } n.item('Level 1', class: 'item') { n.item 'Level 2' } end html = <<-HTML <ul class="semantic-navigation" id="primary"> <li class="group has-nested"> <ul class="is-nested"> <li><a href="/path"><span>Label</span></a></li> </ul> </li> <li class="item has-nested"> <span>Level 1</span> <ul class="is-nested"> <li><span>Level 2</span></li> </ul> </li> </ul> HTML builder.render.should match(clean(html)) end it "handles builder configurations" do builder = subject.new helper, :primary, {config: :bootstrap} do |n| n.group('Group', class: 'group') { n.item "Label", '/path' } n.item('Level 1', class: 'item') { n.item 'Level 2' } n.item('Foo') end html = <<-HTML <ul class="nav nav-pills" id="primary"> <li class="group dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Group<b class='caret'></b></a> <ul class="dropdown-menu"> <li><a href="/path"><span>Label</span></a></li> </ul> </li> <li class="item dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Level 1<b class='caret'></b></a> <ul class="dropdown-menu"> <li><span>Level 2</span></li> </ul> </li> <li><span>Foo</span></li> </ul> HTML builder.render.should match(clean(html)) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
navigasmic-1.0.3 | spec/builders/list_builder_spec.rb |
navigasmic-1.0.2 | spec/builders/list_builder_spec.rb |
navigasmic-1.0.1 | spec/builders/list_builder_spec.rb |