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.
- workarea-core/test/models/workarea/content/asset_test.rb
- workarea-core/test/models/workarea/address_test.rb
- workarea-storefront/test/system/workarea/storefront/discounting_system_test.rb
And the following files are added.
- workarea-core/test/models/workarea/content/asset_validation_test.rb
- workarea-core/test/models/workarea/address_equality_test.rb
- workarea-core/test/models/workarea/address_validation_test.rb
- workarea-storefront/test/system/workarea/storefront/discounting_multiple_system_test.rb
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.
- Modifies Core search model (mixin)
Workarea::Search::Storefront::Product::Categories
- Modifies
category_id
- Modifies
- Modifies Core search model test case
Workarea::Search::Storefront::Product::CategoriesTest
- Removes
test_includes_all_category_ids_the_product_has
- Adds
test_includes_featured_category_ids_the_product_has
- Removes
- Modifies Core search query
Workarea::Search::ProductRules
- Modifies
initialize
- Adds
ignore_category_ids
- Modifies
to_a
- Modifies
category_clauses_for
- Modifies
- Modifies Core search query test case
Workarea::Search::ProductRulesTest
- Modifies
test_category_rules
- Adds
test_category_reference_loop
- Modifies
- Modifies Core search query test case
Workarea::Search::CategoryBrowseTest
- Adds
test_matching_featured_in_category_rule
- Adds
test_matching_rules_and_featured_in_category_rule
- Adds
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.
- Modifies Core model
Workarea::Fulfillment
- Modifies
cancel_items
- Modifies
- Modifies Core model test case
Workarea::FulfillmentTest
- Removes
test_cancel_items_adds_the_shipped_events_to_the_items
- Adds
test_cancel_items_adds_the_canceled_events_to_the_items
- Removes
- Modifies Storefront mailer preview
Workarea::Storefront::FulfillmentMailerPreview
- Modifies
canceled
- Modifies
- Modifies Storefront mailer (Haml) workarea/storefront/fulfillment_mailer/canceled.html.haml
- Modifies Storefront mailer (text) workarea/storefront/fulfillment_mailer/canceled.text.erb
Fixes Rendering of Style Guide Partials
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.
- Modifies Core helper
Workarea::StyleGuidesHelper
- Modifies
partial_paths_for
- Modifies
- Modifies Core helper
Workarea::StyleGuidesHelper::Partials
- Modifies
initialize
- Modifies
name_from
- Modifies
pattern
- Modifies
- Modifies Core helper test case
Workarea::StyleGuidesHelperTest
- Modifies
test_partial_paths
- Modifies
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.
- Modifies Core model
Workarea::Recommendation::UserActivity
- Modifies
self.prepend_field
- Modifies
- Modifies Core model test case
Workarea::Recommendation::UserActivityTest
- Adds
test_id_typecasting
- Adds
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.
- workarea/admin/content/_card.html.haml
- workarea/admin/content/_edit.html.haml
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
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.
- Modifies Admin JavaScript module
WORKAREA.tabs
- Adds
destroy()
- Adds event listener
$(document).on('turbolinks:before-cache', destroy);
- Adds
- Modifies Admin JavaScript module
WORKAREA.publishWithReleaseMenus
- Adds
destroy()
- Adds event listener
$(document).on('turbolinks:before-cache', destroy);
- Adds
- Modifies Admin JavaScript template
workarea/admin/templates/new_release_option.jst.ejs
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.
- Modifies Admin locale file config/locales/en.yml
- Removes translation
workarea.admin.fulfillments.show.on_time_created
- Adds translation
workarea.admin.fulfillments.show.on_time_created_html
- Removes translation
- Modifies Admin view workarea/admin/fulfillments/show.html.haml
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 Admin component stylesheet workarea/admin/components/_chart_legend.scss, which implements:
$chart-legend-dot-size
.chart-legend {}
.chart-legend__item {}
.chart-legend__color-dot {}
.chart-legend__label {}
- Modifies Admin stylesheet manifest workarea/admin/application.scss.erb (to add the above stylesheet)
- Adds Admin style guide partial workarea/admin/style_guides/components/_chart_legend.html.haml
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:
credit_card_gateway
credit_card
(setup)test_perform_does_nothing_if_credit_card_already_has_a_token
test_perform_stores_on_the_gateway
test_perform_sets_the_token_on_the_credit_card
test_save_persists_the_token
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
Usage:
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
Options:
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
Description:
Creates a new Style Guide entry for your application.
Examples:
rails g workarea:style_guide storefront components button
rails g workarea:style_guide admin components button--large