Sha256: 80416288d817c941b81010bbf4a110a673dbff8112ae4950cada1e74fa432309
Contents?: true
Size: 1.8 KB
Versions: 34
Compression:
Stored size: 1.8 KB
Contents
require 'test_helper' module Workarea module Admin class IconsHelperTest < ViewTest include Admin::Engine.routes.url_helpers def current_user @user ||= create_user(admin: true) end def inline_svg(path, options = {}) [path, *options.values] end def link_to(content, path, options = {}) [*content, path, *options.values] end def insights_path_for(model) '' end def test_comments_icon_for page = create_page comment = create_comment(commentable: page) view_model = PageViewModel.wrap(page) result = comments_icon_for(view_model) assert_equal('workarea/admin/icons/comments.svg', result.first) assert_equal(t('workarea.admin.comments.icon.unviewed'), result.second) comment.update(viewed_by_ids: [current_user.id]) view_model = PageViewModel.wrap(page) result = comments_icon_for(view_model) assert_equal('workarea/admin/icons/comments_viewed.svg', result.first) assert_equal(t('workarea.admin.comments.icon.viewed'), result.second) end def test_top_icon_for product = create_product assert_nil(top_icon_for(ProductViewModel.wrap(product))) create_top_products(results: [{ product_id: product.id }]) result = top_icon_for(ProductViewModel.wrap(product)) assert_equal('workarea/admin/icons/star.svg', result.first) end def test_trending_icon_for product = create_product assert_nil(trending_icon_for(ProductViewModel.wrap(product))) create_trending_products(results: [{ product_id: product.id }]) result = trending_icon_for(ProductViewModel.wrap(product)) assert_equal('workarea/admin/icons/fire.svg', result.first) end end end end
Version data entries
34 entries across 34 versions & 1 rubygems