Workarea 3.0.11

Replaces minitest-reporters with minitest-junit


Workarea 3.0.11 replaces minitest-reporters with minitest-junit for CI test reporting. Changes in Rails 5.0.5 caused usability problems in minitest-reporters that likely can't be fixed.

In addition to updating the Core gemspec, the change removes all setup for minitest-reporters from workarea-testing/lib/workarea/test_help.rb and adds a Workarea Minitest plugin at workarea-core/lib/minitest/workarea_plugin.rb to apply the necessary setup for minitest-junit.

Moves Additional Test Cases into Their Own Files


Workarea 3.0.11 modifies and adds several test case files to ensure each file contains only one class definition which matches the file name. Developers reported problems decorating test cases when the class name and file name don't match. This change does not change the Ruby API in any way, only where on disk the classes are defined.

The following files are modified to remove additional class definitions.

And the following files are added.

Fixes Category Rule Changes Requiring Re-Indexing


Applications reported category rule changes not taking effect without re-indexing in some cases. Workarea 3.0.11 applies the following changes to fix this issue.

To receive the full benefit of this change, you must re-index all Storefront indexes, although this is not required and the application will continue to work.

Adds Additional Search Mappings to Prevent Indexing Errors


Workarea 3.0.11 adds the 'facets.category_id' and 'facets.on_sale' properties to the :storefront Elasticsearch mapping in workarea-core/lib/workarea/configuration.rb. This change reduces the chances of errors during indexing.

# workarea-core/lib/workarea/configuration.rb

config.elasticsearch_mappings.storefront = {
  # ...
  storefront: {
    # ...
    properties: {
      id: { type: 'keyword' },
      type: { type: 'keyword' },
      slug: { type: 'keyword' },
      suggestion_content: { type: 'string', analyzer: 'text_analyzer' },

      # This would be covered by the facets dynamic mapping but to reduce
      # the likelihood of no-field-mapping errors, including
      # out-of-the-box mappings here.
      'facets.category_id' => { type: 'keyword' },
      'facets.on_sale' => { type: 'keyword' }

Fixes Fulfillment Cancellation Issues


Workarea 3.0.11 modifies the fulfillment model to prevent adding cancel events to fulfillment items when the canceled quantity is 0. The change also improves the fulfillment mailer implementation.

The PR makes the following changes.

Fixes Rendering of Style Guide Partials

#2639, cb15fc2f585

Workarea 3.0.11 fixes the Core style guides helper to prevent style guide partials rendering in the wrong UI.

The changes are as follows.

Disables HTTP Caching for Admins


Workarea 3.0.11 disables HTTP caching when the current user is an admin.

The change modifies the Storefront controller (mixin) Workarea::Storefront::HttpCaching, changing cache_page to use HTTP cache only if the current user (if any) is not an admin.

Fixes ID Data Types in User Activity


Workarea 3.0.11 typecasts IDs within user activity to resolve an issue that surfaced in a new Storefront recent views API endpoint.

The following changes are applied.

Fixes Display of Content Block Icons


Workarea 3.0.11 modifies the following Admin views, replacing calls to inline_svg with content_block_icon. These changes ensure a fallback icon is used when a custom icon is not provided.

Fixes Clearing Hidden Breakpoints


Workarea 3.0.11 modifies the Admin partial workarea/admin/content/_form.html.haml to fix the clearing of hidden breakpoints from a content block.

The change adds a 'block[hidden_breakpoints][]' hidden field to ensure a value is submitted when all checkboxes are cleared.

Fixes Exception in Inventory Status View Model


Workarea 3.0.11 fixes the Storefront inventory status view model to prevent raising an exception when no inventory sku is available.

The change modifies the Storefront view model Workarea::Storefront::InventoryStatusViewModel, changing message to return an empty string when no inventory sku is available. The change also adds a test, test_message_none_available, to the Storefront view model test case Workarea::Storefront::InventoryStatusViewModelTest.

Fixes Duplicate DOM When Returning to Page

#2700, #2701

Workarea 3.0.11 modifies several Admin JavaScript modules to prevent duplicate DOM nodes in the Admin when returning to a previously visited page. The changes, listed below, add a destroy() function, which is invoked before storing the DOM in the turbolinks cache.

Fixes Display of Package Creation Time in Fulfillment Admin


Workarea 3.0.11 replaces a plain text Admin translation with an HTML translation in order to fix the display of package creation time in the fulfillment Admin screen.

The following changes are applied.

Changes Precompile Asset Paths


Workarea 3.0.11 modifies the list of precompile asset paths in Rails.application.config.assets.precompile, removing the globs workarea/admin/*.svg and workarea/storefront/*.svg, and adding workarea/**/*.svg. The changes occur in the Core initializer workarea-core/config/initializers/02_assets.rb and intend to include all SVG files as precompiled assets.

Adds Styles & Style Guide for Admin Chart Legends


Workarea 3.0.11 adds styles and a style guide for the Admin chart-legend component.

The PR makes the following changes.

Adds Store Credit Card Test Case


Workarea 3.0.11 adds the Core model test case Workarea::Payment::StoreCreditCardTest, which inherits from Workarea::TestCase and implements:

The test case was converted from Workarea's remaining RSpec test suite.

Fixes Style Guide Generator Documentation


Workarea 3.0.11 updates the documentation for the style guide generator in workarea-core/lib/generators/workarea/style_guide/USAGE to reflect changes in effect since Workarea 3.0.

The example below shows the updated documentation.

$ bin/rails g workarea:style_guide
  rails generate workarea:style_guide ENGINE SECTION NAME [options]

Runtime options:
  -f, [--force] # Overwrite files that already exist
  -p, [--pretend], [--no-pretend] # Run but do not make any changes
  -q, [--quiet], [--no-quiet] # Suppress status output
  -s, [--skip], [--no-skip] # Skip files that already exist

  ENGINE is either:
    - admin
    - storefront

  SECTION is an existing section, the workarea gem offers these sections out of the box:
    - settings
    - base
    - typography
    - objects
    - components
    - trumps

  NAME is the name of your partial, separated with dashes:
    - button
    - button--large
    - table--prices

  Creates a new Style Guide entry for your application.

  rails g workarea:style_guide storefront components button
  rails g workarea:style_guide admin components button--large
Now on GitHub