From 84fe6706a2c4aee006406a30005ea2f3f8d55b5e Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 5 Dec 2013 15:50:08 +1100 Subject: [PATCH] Make 'Items' option appear in variant_unit field on BPE --- app/assets/javascripts/admin/bulk_product_update.js.coffee | 2 ++ spec/javascripts/unit/bulk_product_update_spec.js.coffee | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/admin/bulk_product_update.js.coffee b/app/assets/javascripts/admin/bulk_product_update.js.coffee index 631a940d31..c2c4a56af7 100644 --- a/app/assets/javascripts/admin/bulk_product_update.js.coffee +++ b/app/assets/javascripts/admin/bulk_product_update.js.coffee @@ -182,6 +182,8 @@ productsApp.controller "AdminBulkProductsCtrl", [ $scope.loadVariantUnit = (product) -> product.variant_unit_with_scale = if product.variant_unit && product.variant_unit_scale "#{product.variant_unit}_#{product.variant_unit_scale}" + else if product.variant_unit + product.variant_unit else null diff --git a/spec/javascripts/unit/bulk_product_update_spec.js.coffee b/spec/javascripts/unit/bulk_product_update_spec.js.coffee index c42028a2b9..282811aa3f 100644 --- a/spec/javascripts/unit/bulk_product_update_spec.js.coffee +++ b/spec/javascripts/unit/bulk_product_update_spec.js.coffee @@ -386,10 +386,10 @@ describe "AdminBulkProductsCtrl", -> scope.loadVariantUnit product expect(product.variant_unit_with_scale).toBeNull() - it 'sets variant_unit_with_scale to null when variant_unit_scale is null', -> - product = {variant_unit: 'weight', variant_unit_scale: null} + it 'sets variant_unit_with_scale to variant_unit when variant_unit_scale is null', -> + product = {variant_unit: 'items', variant_unit_scale: null, variant_unit_name: 'foo'} scope.loadVariantUnit product - expect(product.variant_unit_with_scale).toBeNull() + expect(product.variant_unit_with_scale).toEqual "items" describe "getting on_hand counts when products have variants", ->