Sha256: 79987f585d3d6582f9a2e3a45a2ce5923cdb845a82ff21f24d802c15751c749c

Contents?: true

Size: 984 Bytes

Versions: 52

Compression:

Stored size: 984 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

52 entries across 52 versions & 1 rubygems

Version Path
express_admin-2.0.0.b test/dummy/test/components/mega_menu_test.rb
express_admin-2.0.0.a test/dummy/test/components/mega_menu_test.rb
express_admin-1.8.1 test/dummy/test/components/mega_menu_test.rb
express_admin-1.8.0 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.32 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.31 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.30 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.29 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.28 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.27 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.26 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.25 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.24 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.23 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.22 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.21 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.20 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.19 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.18 test/dummy/test/components/mega_menu_test.rb
express_admin-1.7.17 test/dummy/test/components/mega_menu_test.rb