Sha256: 297530d24d5aaa7086012a96d5574a69305fa3d443b7dbf60cb15003067a0ebf

Contents?: true

Size: 1.06 KB

Versions: 37

Compression:

Stored size: 1.06 KB

Contents

require 'test_helper'

module PushType
  module MenuBuilder
    class Dsl::MenuItemTest < ActiveSupport::TestCase

      let(:item) { MenuBuilder::MenuItem.new(:bar) }

      describe '.build' do
        before do
          MenuBuilder::Dsl::MenuItem.build(item) do
            text 'FooBar'
            link '/foobar'
            active { 1 == 1 }
            element :div
            item_options class: 'foo-bar', data: { foo: 'bar' }
            link_options class: 'foo-baz', data: { foo: 'baz' }
            active_class 'foo-active'
          end
        end

        it { item.text.must_equal 'FooBar' }
        it { item.link.must_equal '/foobar' }
        it { item.active.call.must_equal true }
        it { item.element.must_equal :div }
        it { item.item_options[:class].must_equal 'foo-bar' }
        it { item.item_options[:data][:foo].must_equal 'bar' }
        it { item.link_options[:class].must_equal 'foo-baz' }
        it { item.link_options[:data][:foo].must_equal 'baz' }
        it { item.active_class.must_equal 'foo-active' }
      end

    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
push_type_core-0.12.1 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.12.0 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.12.0.beta.1 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.11.2 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.11.1 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.11.0.beta.2 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.11.0.beta.1 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.10.4 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.10.3 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.10.2 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.10.1 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.10.0 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.10.0.beta.5 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.10.0.beta.3 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.9.5 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.9.3 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.9.2 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.9.1 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.9.0 test/lib/push_type/menu_builder/menu_item_dsl_test.rb
push_type_core-0.9.0.beta.4 test/lib/push_type/menu_builder/menu_item_dsl_test.rb