Sha256: 923291bcd79e05197bf40d5193c7ca85c773d7af45fb0969f50d45879eb3d5c4

Contents?: true

Size: 1.74 KB

Versions: 62

Compression:

Stored size: 1.74 KB

Contents

require 'test_helper'

module Workarea
  class StyleGuidesHelperTest < ViewTest
    include Admin::Engine.routes.url_helpers

    def test_partial_paths
      partials = StyleGuidesHelper::Partials.new(
        Storefront::Engine.root,
        'storefront',
        'settings'
      )

      assert_includes(
        partials.to_a,
        'workarea/storefront/style_guides/settings/color_variables'
      )

      partials = StyleGuidesHelper::Partials.new(
        Admin::Engine.root,
        'admin',
        'settings'
      )

      assert_includes(
        partials.to_a,
        'workarea/admin/style_guides/settings/color_variables'
      )
    end

    def test_adds_an_anchor_to_a_style_guide_modifier
      result = link_to_style_guide('foo', 'bar__baz')

      assert_includes(result, '/bar#bar--baz')
    end

    def test_adds_a_custom_anchor_to_a_style_guide_modifier
      result = link_to_style_guide('foo', 'bar__baz', false, 'bat')

      assert_includes(result, '/bar#bar--baz')
      assert_includes(result, '>bat</a>')
    end

    def test_style_guide_icons
      stubs(:parent_module).returns(Workarea::Storefront)
      filenames = style_guide_icons.map { |i| File.basename(i) }
      facebook_icons = filenames.select { |n| n == 'facebook.svg' }

      assert_includes(filenames, 'facebook.svg')
      assert_equal(1, facebook_icons.length)
    end

    def test_style_guide_icons_maintain_alphanumeric_sort_order
      stubs(:parent_module).returns(Workarea::Storefront)

      filenames = style_guide_icons.map { |i| File.basename(i) }
      facebook_icon_index = filenames.find_index('facebook.svg')
      twitter_icon_index = filenames.find_index('twitter.svg')

      assert_operator(facebook_icon_index, :<, twitter_icon_index)
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.15 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.36 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.14 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.35 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.13 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.34 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.12 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.33 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.11 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.10 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.32 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.9 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.31 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.8 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.30 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.7 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.29 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.6 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.4.28 test/helpers/workarea/style_guides_helper_test.rb
workarea-core-3.5.5 test/helpers/workarea/style_guides_helper_test.rb