workarea-admin 3.5.19 → 3.5.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/workarea/admin/modules/new_navigation_taxons.js +2 -1
  3. data/app/controllers/workarea/admin/create_release_undos_controller.rb +19 -5
  4. data/app/controllers/workarea/admin/impersonations_controller.rb +2 -1
  5. data/app/controllers/workarea/admin/releases_controller.rb +1 -4
  6. data/app/helpers/workarea/admin/application_helper.rb +4 -0
  7. data/app/helpers/workarea/admin/changesets_helper.rb +20 -4
  8. data/app/view_models/workarea/admin/changeset_summary_view_model.rb +39 -0
  9. data/app/view_models/workarea/admin/product_view_model.rb +5 -8
  10. data/app/view_models/workarea/admin/release_view_model.rb +22 -3
  11. data/app/views/workarea/admin/catalog_categories/edit.html.haml +3 -0
  12. data/app/views/workarea/admin/catalog_products/_cards.html.haml +1 -1
  13. data/app/views/workarea/admin/changesets/index.html.haml +30 -1
  14. data/app/views/workarea/admin/create_release_undos/new.html.haml +6 -3
  15. data/app/views/workarea/admin/create_release_undos/review.html.haml +8 -2
  16. data/app/views/workarea/admin/navigation_menus/_summary.html.haml +1 -1
  17. data/app/views/workarea/admin/navigation_redirects/index.html.haml +5 -0
  18. data/app/views/workarea/admin/pricing_discounts/properties/_product_attribute.html.haml +1 -1
  19. data/app/views/workarea/admin/releases/_cards.html.haml +8 -67
  20. data/app/views/workarea/admin/releases/show.html.haml +8 -0
  21. data/app/views/workarea/admin/tax_categories/_cards.html.haml +1 -1
  22. data/app/views/workarea/admin/tax_rates/edit.html.haml +3 -3
  23. data/app/views/workarea/admin/tax_rates/index.html.haml +3 -3
  24. data/app/views/workarea/admin/tax_rates/new.html.haml +3 -3
  25. data/app/views/workarea/admin/toolbar/show.html.haml +1 -0
  26. data/app/views/workarea/admin/users/insights.html.haml +12 -0
  27. data/config/locales/en.yml +25 -36
  28. data/config/routes.rb +3 -5
  29. data/test/helpers/workarea/admin/changesets_helper_test.rb +24 -0
  30. data/test/integration/workarea/admin/create_release_undos_integration_test.rb +27 -2
  31. data/test/integration/workarea/admin/impersonations_integration_test.rb +24 -1
  32. data/test/javascripts/fixtures/existing_navigation_taxon.html.haml +10 -0
  33. data/test/javascripts/new_navigation_taxons_spec.js +12 -1
  34. data/test/system/workarea/admin/assets_system_test.rb +1 -1
  35. data/test/system/workarea/admin/bookmarks_system_test.rb +2 -2
  36. data/test/system/workarea/admin/bulk_actions_system_test.rb +5 -5
  37. data/test/system/workarea/admin/comments_system_test.rb +1 -1
  38. data/test/system/workarea/admin/content_system_test.rb +1 -1
  39. data/test/system/workarea/admin/dashboard_system_test.rb +1 -1
  40. data/test/system/workarea/admin/impersonation_system_test.rb +2 -5
  41. data/test/system/workarea/admin/inventory_skus_system_test.rb +1 -1
  42. data/test/system/workarea/admin/menus_system_test.rb +1 -1
  43. data/test/system/workarea/admin/pricing_sku_prices_system_test.rb +3 -3
  44. data/test/system/workarea/admin/recommendations_system_test.rb +2 -2
  45. data/test/system/workarea/admin/releases_system_test.rb +51 -22
  46. data/test/system/workarea/admin/tax_categories_system_test.rb +6 -5
  47. data/test/system/workarea/admin/taxonomy_system_test.rb +2 -2
  48. data/test/system/workarea/admin/trash_system_test.rb +1 -1
  49. data/test/view_models/workarea/admin/product_view_model_test.rb +2 -2
  50. metadata +10 -9
  51. data/app/views/workarea/admin/releases/original.html.haml +0 -50
  52. data/app/views/workarea/admin/releases/undo.html.haml +0 -64
@@ -20,6 +20,11 @@
20
20
  .grid__cell.grid__cell--80
21
21
  .grid.grid--auto.grid--right
22
22
  - if !@release.has_changes?
23
+ .grid__cell
24
+ = link_to t('workarea.admin.releases.show.build_undo'), '#no-changes-to-undo-info', disabled: 'disabled', data: { tooltip: '' }, class: 'workflow-bar__button'
25
+ #no-changes-to-undo-info.tooltip-content
26
+ %p= t('workarea.admin.releases.show.no_changes_to_undo')
27
+
23
28
  .grid__cell
24
29
  = link_to t('workarea.admin.releases.show.visit_storefront_to_preview'), '#no-changes-to-preview-info', disabled: 'disabled', data: { tooltip: '' }, class: 'workflow-bar__button workflow-bar__button--update workflow-bar__button--disabled'
25
30
  #no-changes-to-preview-info.tooltip-content
@@ -31,6 +36,9 @@
31
36
  %p= t('workarea.admin.releases.show.no_changes_to_publish')
32
37
 
33
38
  - else
39
+ .grid__cell
40
+ = link_to t('workarea.admin.releases.show.build_undo'), new_release_undo_path(@release), class: 'workflow-bar__button'
41
+
34
42
  .grid__cell
35
43
  - if @release.published? && !@release.scheduled?
36
44
  = link_to t('workarea.admin.releases.show.visit_storefront_to_preview'), '#cannot-preview-info', disabled: 'disabled', data: { tooltip: '' }, class: 'workflow-bar__button workflow-bar__button--update workflow-bar__button--disabled'
@@ -37,7 +37,7 @@
37
37
  %ul.list-reset
38
38
  - model.newest_rates.each do |rate|
39
39
  %li
40
- %strong= number_to_percentage(rate.percentage * 100, precision: 1)
40
+ %strong= number_to_percentage(rate.percentage * 100, strip_insignificant_zeros: true)
41
41
 
42
42
  - if rate.tier_min.present? && rate.tier_max.present?
43
43
  #{number_to_currency(rate.tier_min)} - #{number_to_currency(rate.tier_max)},
@@ -21,7 +21,7 @@
21
21
  .grid__cell.grid__cell--50
22
22
  .property
23
23
  = label_tag 'rate_country_percentage', t('workarea.admin.tax_rates.index.table.country_percentage'), class: 'property__name'
24
- = number_field_tag 'rate[country_percentage]', @rate.country_percentage * 100, min: 0, max: 100, step: 0.01, class: 'text-box text-box--i18n'
24
+ = number_field_tag 'rate[country_percentage]', @rate.country_percentage.to_f * 100, min: 0, max: 100, step: '0.001', class: 'text-box text-box--i18n'
25
25
 
26
26
  .grid__cell.grid__cell--50
27
27
  .property
@@ -31,7 +31,7 @@
31
31
  .grid__cell.grid__cell--50
32
32
  .property
33
33
  = label_tag 'rate_region_percentage', t('workarea.admin.tax_rates.index.table.region_percentage'), class: 'property__name'
34
- = number_field_tag 'rate[region_percentage]', @rate.region_percentage * 100, min: 0, max: 100, step: 0.01, class: 'text-box text-box--i18n'
34
+ = number_field_tag 'rate[region_percentage]', @rate.region_percentage.to_f * 100, min: 0, max: 100, step: '0.001', class: 'text-box text-box--i18n'
35
35
 
36
36
  .grid__cell.grid__cell--50
37
37
  .property
@@ -41,7 +41,7 @@
41
41
  .grid__cell.grid__cell--50
42
42
  .property
43
43
  = label_tag 'rate_postal_code_percentage', t('workarea.admin.tax_rates.index.table.postal_code_percentage'), class: 'property__name'
44
- = number_field_tag 'rate[postal_code_percentage]', @rate.postal_code_percentage * 100, min: 0, max: 100, step: 0.01, class: 'text-box text-box--i18n'
44
+ = number_field_tag 'rate[postal_code_percentage]', @rate.postal_code_percentage.to_f * 100, min: 0, max: 100, step: '0.001', class: 'text-box text-box--i18n'
45
45
 
46
46
  .grid__cell.grid__cell--33
47
47
  .property
@@ -56,9 +56,9 @@
56
56
  %td.align-center= rate.country.try(&:alpha2) || '-'
57
57
  %td.align-center= rate.region || '-'
58
58
  %td.align-center= rate.postal_code.presence || '-'
59
- %td.align-center= number_to_percentage(rate.country_percentage * 100, precision: 1)
60
- %td.align-center= number_to_percentage(rate.region_percentage * 100, precision: 1)
61
- %td.align-center= number_to_percentage(rate.postal_code_percentage * 100, precision: 1)
59
+ %td.align-center= number_to_percentage(rate.country_percentage.to_f * 100, strip_insignificant_zeros: true)
60
+ %td.align-center= number_to_percentage(rate.region_percentage.to_f * 100, strip_insignificant_zeros: true)
61
+ %td.align-center= number_to_percentage(rate.postal_code_percentage.to_f * 100, strip_insignificant_zeros: true)
62
62
  %td.align-center= rate.tier_min.present? ? number_to_currency(rate.tier_min) : t('workarea.admin.tax_rates.index.not_applicable')
63
63
  %td.align-center= rate.tier_max.present? ? number_to_currency(rate.tier_max) : t('workarea.admin.tax_rates.index.not_applicable')
64
64
  %td.align-center= rate.charge_on_shipping ? t('workarea.admin.true') : t('workarea.admin.false')
@@ -19,7 +19,7 @@
19
19
  .grid__cell.grid__cell--50
20
20
  .property
21
21
  = label_tag 'rate_country_percentage', t('workarea.admin.tax_rates.index.table.country_percentage'), class: 'property__name'
22
- = number_field_tag 'rate[country_percentage]', @rate.country_percentage * 100, min: 0, max: 100, step: 0.01, class: 'text-box'
22
+ = number_field_tag 'rate[country_percentage]', @rate.country_percentage.to_f * 100, min: 0, max: 100, step: '0.001', class: 'text-box'
23
23
 
24
24
  .grid__cell.grid__cell--50
25
25
  .property
@@ -29,7 +29,7 @@
29
29
  .grid__cell.grid__cell--50
30
30
  .property
31
31
  = label_tag 'rate_region_percentage', t('workarea.admin.tax_rates.index.table.region_percentage'), class: 'property__name'
32
- = number_field_tag 'rate[region_percentage]', @rate.region_percentage * 100, min: 0, max: 100, step: 0.01, class: 'text-box'
32
+ = number_field_tag 'rate[region_percentage]', @rate.region_percentage.to_f * 100, min: 0, max: 100, step: '0.001', class: 'text-box'
33
33
 
34
34
  .grid__cell.grid__cell--50
35
35
  .property
@@ -39,7 +39,7 @@
39
39
  .grid__cell.grid__cell--50
40
40
  .property
41
41
  = label_tag 'rate_postal_code_percentage', t('workarea.admin.tax_rates.index.table.postal_code_percentage'), class: 'property__name'
42
- = number_field_tag 'rate[postal_code_percentage]', @rate.postal_code_percentage * 100, min: 0, max: 100, step: 0.01, class: 'text-box'
42
+ = number_field_tag 'rate[postal_code_percentage]', @rate.postal_code_percentage.to_f * 100, min: 0, max: 100, step: '0.001', class: 'text-box'
43
43
 
44
44
  .grid__cell.grid__cell--33
45
45
  .property
@@ -81,6 +81,7 @@
81
81
  = link_to current_impersonation.email, user_path(current_impersonation)
82
82
  %br
83
83
  = form_tag impersonations_path, method: 'delete', data: { disable_delete_confirmation: '' } do
84
+ = hidden_field_tag :return_to, return_to
84
85
  = button_tag t('workarea.admin.toolbar.stop_impersonation'), class: 'text-button text-button--destroy'
85
86
 
86
87
  - if allow_pricing_override?
@@ -106,6 +106,18 @@
106
106
  = @user.insights.average_order_value_percentile.ordinalize
107
107
  = t('workarea.admin.users.insights.percentile')
108
108
 
109
+ .align-center
110
+ = link_to '#customer-insights-info', data: { tooltip: { side: 'bottom', interactive: true } } do
111
+ = t('workarea.admin.users.insights.customer_insights')
112
+ #customer-insights-info.tooltip-content.align-center
113
+ = t( |
114
+ 'workarea.admin.users.insights.customer_insights_info_html', |
115
+ best_customers_path: insights_report_path(type: Workarea::Insights::BestCustomers), |
116
+ customers_at_risk_path: insights_report_path(type: Workarea::Insights::CustomersAtRisk), |
117
+ repeat_purchase_rate_path: insights_report_path(type: Workarea::Insights::RepeatPurchaseRate), |
118
+ orders_path: orders_user_path(@user) |
119
+ ) |
120
+
109
121
  .section
110
122
  %h2.align-center= t('workarea.admin.users.insights.recently_viewed.title')
111
123
  .grid.grid--center
@@ -303,6 +303,7 @@ en:
303
303
  views: views
304
304
  edit:
305
305
  client_id_note: Identifies the category for product import
306
+ default_sort_note: 'Since this category has featured products, this sort controls the products listed after the selected featured products.'
306
307
  filters_note_html: 'Comma separated: just, like, this. If these fields are blank, the global values will be used from %{search_settings_link}.'
307
308
  page_title: Attributes for %{category}
308
309
  search_settings: search settings
@@ -580,8 +581,12 @@ en:
580
581
  no_changesets: There aren't any planned changes for this release.
581
582
  plan_some_changes: Go plan some changes!
582
583
  planned_changes_for: Planned Changes For
584
+ pluralize_change:
585
+ one: '%{count} Change'
586
+ other: '%{count} Changes'
583
587
  published_on: Published On
584
588
  publishes_on: Publishes On
589
+ recent: Recent Changes
585
590
  releases: Releases
586
591
  unscheduled: Unscheduled
587
592
  catalog_product_copies:
@@ -1215,6 +1220,7 @@ en:
1215
1220
  review:
1216
1221
  title: Review Undo Changes for %{name}
1217
1222
  changes_description_html: These changes have been saved on the %{undo} release. They are the opposite of the changes in the %{original} release. You can view, edit, or delete these changes like changes in a normal release.
1223
+ change_count_message: The full list of changes is generating and too large to display. To make further changes, finish creating the release then view the changes card.
1218
1224
  workflow:
1219
1225
  setup: Setup
1220
1226
  review: Review
@@ -2489,6 +2495,10 @@ en:
2489
2495
  destination_label: Redirect To
2490
2496
  destination_note: Can be any URL
2491
2497
  destination_placeholder: "/new/path.html"
2498
+ disabled: >
2499
+ This application is configured to consider requests to be local, so the Workarea exception handling isn't used.
2500
+ This is most likely because it's running the development environment, where you want exceptions to be seen in responses.
2501
+ These redirects won't work without this.
2492
2502
  from: From
2493
2503
  import: Import Redirects
2494
2504
  modified: Modified
@@ -3100,19 +3110,6 @@ en:
3100
3110
  changes: Changes
3101
3111
  empty_note: You can view and manage changes for this release once they are planned.
3102
3112
  planned: Planned
3103
- undo:
3104
- title: Undo
3105
- not_setup: This release doesn't have an undo setup.
3106
- build_an_undo: Build an Undo
3107
- set_to_publish_html: "%{link} is set to publish at <strong>%{at}</strong>."
3108
- published_html: "%{link} published at <strong>%{at}</strong>."
3109
- unscheduled_html: "%{link} is unscheduled."
3110
- undo_html: The %{link} release was created <strong>%{at}</strong> to undo this release.
3111
- learn_more: Learn More
3112
- original:
3113
- title: Original Release
3114
- undoes_html: This release undoes the %{link} release.
3115
- learn_more: Learn More
3116
3113
  edit:
3117
3114
  index_link: Release calendar
3118
3115
  last_published_at: Last Published at
@@ -3178,6 +3175,7 @@ en:
3178
3175
  view: View
3179
3176
  view_release: View Release
3180
3177
  show:
3178
+ build_undo: Build Undo
3181
3179
  index_link: Release calendar
3182
3180
  plan_changes_to_preview: Plan some changes to preview this release
3183
3181
  publish_now: Publish Now
@@ -3190,8 +3188,6 @@ en:
3190
3188
  no_changes_to_publish: There are no changes to publish for this release. Click on the Plan Changes card to start!
3191
3189
  no_changes_to_undo: There are no changes to undo for this release. Click on the Plan Changes card to start!
3192
3190
  user_cannot_publish_info: You do not have permission to publish a release.
3193
- cannot_undo_info: You cannot undo a release that's not published or already undone.
3194
- user_cannot_undo_info: You do not have permission to undo a release.
3195
3191
  summary:
3196
3192
  change:
3197
3193
  one: "%{count} Change"
@@ -3216,24 +3212,6 @@ en:
3216
3212
  starts_on: Starts on %{date}
3217
3213
  ends_on: Ends on %{date}
3218
3214
  no_undo_date: There is no undo date set for this release.
3219
- undo:
3220
- page_title: Undo %{name}
3221
- index_link: Release calendar
3222
- plan_changes: Plan Changes
3223
- no_changes_html: There are no changes to undo for this release! Head to %{plan_changes} to make some.
3224
- undoing: Undoing a Release
3225
- description: You can setup an undo to automatically revert the changes in this release at a future point in time. After being setup, this "undo release" will behave like any other release. You'll be able to edit, reschdule, or modify the changes as you please.
3226
- build_an_undo_now: Build an Undo Now
3227
- created_description_html: "%{undo} was created %{at} to undo the %{original} release."
3228
- no_changes_for_this_release: No changes for this release now.
3229
- view_the_undo_release: View the Undo Release
3230
- original:
3231
- page_title: Original Release for %{name}
3232
- index_link: Release calendar
3233
- title: Original Release
3234
- created_description_html: "%{undo} was created %{at} to undo the %{original} release."
3235
- no_changes_for_this_release: No changes for this release now.
3236
- view_the_original_release: View the Original Release
3237
3215
  reports:
3238
3216
  all_reports: View All Reports
3239
3217
  average_order_value:
@@ -3506,10 +3484,10 @@ en:
3506
3484
  description: Define what filters should be shown on search results and categories.
3507
3485
  title: Filters
3508
3486
  synonyms:
3509
- description: Define groups of search terms that should return the same result.
3487
+ description: Define groups of search terms that mean the same thing. Keep in mind this is not the same as "return the same results". For that task, use search customizations.
3510
3488
  phrase_example: united states,u s a,united states of america => usa
3511
3489
  phrase_example_description: 'You can create synonym functionality out of a phrase like so:'
3512
- simple_example: "tshirt, t-shirt, tee-shirt \nskirt, skort"
3490
+ simple_example: "denim, jeans, dungarees \nshirt, pullover, blouse"
3513
3491
  simple_example_description: 'Enter one synonym group per line, for example:'
3514
3492
  title: Synonyms
3515
3493
  title: Search Settings
@@ -4024,7 +4002,7 @@ en:
4024
4002
  changes_saved: Your changes have been saved
4025
4003
  saved: Your changes have been saved
4026
4004
  started: You are now browsing as %{email}
4027
- stopped: Impersonation for this user has been stopped.
4005
+ stopped: Impersonation has been stopped, you are now browsing as your account.
4028
4006
  created: This account has been created
4029
4007
  error: There was an error saving this account
4030
4008
  password_reset: Password reset created. User will receive an email shortly.
@@ -4067,6 +4045,17 @@ en:
4067
4045
  aov: AOV
4068
4046
  insights_for_this_customer: Insights for this Customer
4069
4047
  percentile: percentile
4048
+ customer_insights: Wondering about how Workarea customer insights work?
4049
+ customer_insights_info_html: >
4050
+ <strong>How are customer metrics tracked?</strong>
4051
+ <p>Workarea's metrics engine saves reporting and insights data based on the customer's email address.
4052
+ This allows for the best tracking of customers for generating helpful insights like
4053
+ <a href="%{best_customers_path}">Best Customers</a>, <a href="%{customers_at_risk_path}">Customers at Risk</a>,
4054
+ and <a href="%{repeat_purchase_rate_path}">Repeat Purchase Rate</a> as accurately as possible across both
4055
+ guest and account checkouts.</p>
4056
+ <strong>Wondering why some numbers don't line up?</strong>
4057
+ <p>Because reporting is tracked by email address, changes in email address and/or having an account
4058
+ can cause mismatch between the <a href="%{orders_path}">Orders</a> card and these insights.</p>
4070
4059
  login:
4071
4060
  never: Never logged in
4072
4061
  time_ago: "%{period} ago"
@@ -108,15 +108,13 @@ Workarea::Admin::Engine.routes.draw do
108
108
  resources :releases do
109
109
  resources :changesets, only: [:index, :destroy]
110
110
  resources :releasables, only: [:index, :show]
111
- resource :undo, controller: 'create_release_undos', only: [:new, :create] do
112
- get :review
113
- post :complete
111
+
112
+ resources :undos, controller: 'create_release_undos', only: [:new, :create] do
113
+ member { get :review }
114
114
  end
115
115
 
116
116
  member do
117
117
  get 'edit_for/:type', action: :edit_for, as: :edit_for
118
- get :undo
119
- get :original
120
118
  patch :publish
121
119
  end
122
120
 
@@ -0,0 +1,24 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class ChangesetsHelperTest < ViewTest
6
+ def test_releasable_icon_path
7
+ assert_equal(
8
+ releasable_icon_path(nil),
9
+ 'workarea/admin/icons/release.svg'
10
+ )
11
+
12
+ assert_equal(
13
+ releasable_icon_path('product'),
14
+ 'workarea/admin/icons/products.svg'
15
+ )
16
+
17
+ assert_equal(
18
+ releasable_icon_path('variants'),
19
+ 'workarea/admin/icons/variants.svg'
20
+ )
21
+ end
22
+ end
23
+ end
24
+ end
@@ -10,19 +10,44 @@ module Workarea
10
10
  release = create_release
11
11
 
12
12
  release.as_current { releasable.update_attributes!(name: 'Bar') }
13
+ release.changesets.create!(releasable: Catalog::Product.new) # test missing releasable
13
14
 
14
- post admin.release_undo_path(release),
15
+ post admin.release_undos_path(release),
15
16
  params: { release: { name: 'Undo Bar', tag_list: 'foo,bar,baz' } }
16
17
 
17
18
  assert_equal(2, Release.count)
18
19
  undo_release = Release.desc(:created_at).first
19
20
 
20
- assert_equal(undo_release, release.reload.undo)
21
+ assert_equal(undo_release, release.reload.undos.first)
21
22
  assert_equal('Undo Bar', undo_release.name)
22
23
  assert_equal(%w(foo bar baz), undo_release.tags)
23
24
  assert_equal(1, undo_release.changesets.size)
24
25
  assert_equal(1, undo_release.changesets.first.changeset.size)
25
26
  assert_equal(releasable, undo_release.changesets.first.releasable)
27
+ assert_equal([releasable], Search::AdminSearch.new(upcoming_changes: [undo_release.id]).results)
28
+ end
29
+
30
+ def test_create_for_large_changesets
31
+ Sidekiq::Testing.fake!
32
+
33
+ Workarea.config.per_page = 1
34
+
35
+ releasable_one = create_page(name: 'Foo')
36
+ releasable_two = create_page(name: 'Bar')
37
+ release = create_release
38
+
39
+ release.as_current do
40
+ releasable_one.update!(name: 'Changed Foo')
41
+ releasable_two.update!(name: 'Changed Bar')
42
+ end
43
+
44
+ post admin.release_undos_path(release),
45
+ params: { release: { name: 'Undo Test' } }
46
+
47
+ assert_equal(2, Release.count)
48
+ undo_release = Release.desc(:created_at).first
49
+ assert_equal(1, undo_release.changesets.size)
50
+ assert_equal(1, BuildReleaseUndoChangesets.jobs.size)
26
51
  end
27
52
  end
28
53
  end
@@ -50,11 +50,34 @@ module Workarea
50
50
 
51
51
  post admin.impersonations_path, params: { user_id: @user.id }
52
52
  delete admin.impersonations_path
53
+ assert_equal(previous_user_id, session[:user_id])
54
+ assert(session[:admin_id].blank?)
53
55
 
54
- assert(response.redirect?)
56
+ post admin.impersonations_path, params: { user_id: @user.id }
57
+ delete admin.impersonations_path
55
58
  assert_equal(previous_user_id, session[:user_id])
56
59
  assert(session[:admin_id].blank?)
57
60
  end
61
+
62
+ def test_redirection_after_destroy
63
+ post admin.impersonations_path, params: { user_id: @user.id }
64
+ delete admin.impersonations_path
65
+ assert_redirected_to(admin.user_path(@user.id))
66
+
67
+ post admin.impersonations_path, params: { user_id: @user.id }
68
+ delete admin.impersonations_path(return_to: '/foo')
69
+ assert_redirected_to('/foo')
70
+
71
+ post admin.impersonations_path, params: { user_id: @user.id }
72
+ delete admin.impersonations_path(return_to: '/foo'),
73
+ headers: { 'HTTP_REFERER' => admin.catalog_products_path }
74
+ assert_redirected_to('/foo')
75
+
76
+ post admin.impersonations_path, params: { user_id: @user.id }
77
+ delete admin.impersonations_path,
78
+ headers: { 'HTTP_REFERER' => admin.catalog_products_url(host: 'foo.com') }
79
+ assert_redirected_to(admin.catalog_products_path)
80
+ end
58
81
  end
59
82
  end
60
83
  end
@@ -0,0 +1,10 @@
1
+ .new-navigation-link__section{ data: { new_navigation_taxon: 'bar' } }
2
+ %fieldset
3
+ %legend
4
+ %span.heading.heading--2 Existing
5
+ .property
6
+ = label_tag 'navigable_type', 'Type', class: 'property__name'
7
+ = select_tag 'navigable_type', options_for_select([['Foo', 'foo', { data: { new_navigation_taxon_endpoint: 'http://foo.com' } }], ['Bar', 'bar', { data: { new_navigation_taxon_endpoint: 'http://bar.com' } }]])
8
+ .property
9
+ = label_tag 'navigable_id', 'Name', class: 'property__name'
10
+ = select_tag 'navigable_id', options_for_select([['Bar', 'bar']], 'bar'), include_blank: true
@@ -6,7 +6,6 @@
6
6
  it('initializes select2 on navigable id select', function () {
7
7
  var markup = 'new_navigation_taxon.html',
8
8
  $fixture = $(fixture.load(markup, true)),
9
-
10
9
  $select = $('[name=navigable_id]', $fixture);
11
10
 
12
11
  expect($select.is('.select2-hidden-accessible')).to.not.be.ok;
@@ -14,6 +13,18 @@
14
13
  WORKAREA.newNavigationTaxons.init($fixture);
15
14
 
16
15
  expect($select.is('.select2-hidden-accessible')).to.be.ok;
16
+ expect($select.val()).to.equal('');
17
+ });
18
+
19
+ it('saves with the existing data', function () {
20
+ var markup = 'existing_navigation_taxon.html',
21
+ $fixture = $(fixture.load(markup, true)),
22
+ $select = $('[name=navigable_id]', $fixture);
23
+
24
+ WORKAREA.newNavigationTaxons.init($fixture);
25
+
26
+ expect($select.is('.select2-hidden-accessible')).to.be.ok;
27
+ expect($select.val()).to.equal('bar');
17
28
  });
18
29
  });
19
30
  });
@@ -27,7 +27,7 @@ module Workarea
27
27
 
28
28
  assert_current_path(admin.content_assets_path)
29
29
  assert(page.has_content?('Success'))
30
- refute(page.has_content?('Edited Asset'))
30
+ refute_text('Edited Asset')
31
31
  end
32
32
 
33
33
  def test_insertion
@@ -16,7 +16,7 @@ module Workarea
16
16
 
17
17
  find('.message__dismiss-button').click
18
18
  find('#shortcuts_menu').hover
19
- refute(page.has_content?('Current Page'))
19
+ refute_text('Current Page')
20
20
 
21
21
  find('#shortcuts_menu').hover
22
22
  menu_item = all('.menu__item').last
@@ -24,7 +24,7 @@ module Workarea
24
24
  find('.menu__delete-link').click
25
25
  assert_current_path(admin.root_path)
26
26
  assert(page.has_content?('Success'))
27
- refute(page.has_content?('Current Page'))
27
+ refute_text('Current Page')
28
28
  end
29
29
  end
30
30
  end