Sha256: 8d2dfe20fb4b54f13f8070da6742ee4b3bd8cca813ad2b0f32673adedb932460

Contents?: true

Size: 986 Bytes

Versions: 4

Compression:

Stored size: 986 Bytes

Contents

require 'test_helper'

module ExpressAdmin

  class MegaMenuTest < ActiveSupport::TestCase

    class MenuItem
      attr_accessor :title, :path

      def initialize(title, path)
        @title = title
        @path = path
      end
    end

    def rendered_mega_menu
      arbre {
        mega_menu
      }
    end

    def helpers
      OpenStruct.new(
        admin_menus: [MenuItem.new('Big Menu', 'my_path'), MenuItem.new('Foo', 'another_path')],
        my_path: 'evaled_path',
        another_path: 'some_path'
      )
    end

    test "renders" do
      assert rendered_mega_menu
    end	

    test "links menu to eval'd path" do
      assert_match /href="evaled_path"/, rendered_mega_menu
      assert_match /href="some_path"/, rendered_mega_menu
    end 

    test "replaces whitespace in menu title to underscore for icon class" do
      assert_match /icon-express_big_menu/, rendered_mega_menu
      assert_match /icon-express_foo/, rendered_mega_menu
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
express_admin-1.4.8 test/dummy/test/components/mega_menu_test.rb
express_admin-1.4.7 test/dummy/test/components/mega_menu_test.rb
express_admin-1.4.6 test/dummy/test/components/mega_menu_test.rb
express_admin-1.4.5 test/dummy/test/components/mega_menu_test.rb