Skip to content

Instantly share code, notes, and snippets.

@biscuitvile
Created December 23, 2014 23:13
Show Gist options
  • Save biscuitvile/ce405058b5f67778b634 to your computer and use it in GitHub Desktop.
Save biscuitvile/ce405058b5f67778b634 to your computer and use it in GitHub Desktop.
diff --git a/app/assets/javascripts/mobile/views/product_form_view.js.coffee b/app/assets/javascripts/mobile/views/product_form_view.js.coffee
index cddbc4f..e2f67cb 100644
--- a/app/assets/javascripts/mobile/views/product_form_view.js.coffee
+++ b/app/assets/javascripts/mobile/views/product_form_view.js.coffee
@@ -228,7 +228,7 @@ class ProductFormView extends FormView
@ui.addOption.show()
optionsLength: ->
- @ui.optionsList.find('li').length
+ @ui.optionsList.find('li.option').length
maximumOptions: ->
@ui.optionsPanel.data('maximum')
diff --git a/spec/javascripts/mobile/views/product_form_view_spec.coffee b/spec/javascripts/mobile/views/product_form_view_spec.coffee
index f9a25e4..ba2b449 100644
--- a/spec/javascripts/mobile/views/product_form_view_spec.coffee
+++ b/spec/javascripts/mobile/views/product_form_view_spec.coffee
@@ -40,8 +40,8 @@ describe "Product Form View", ->
describe "#optionsLength", ->
it "returns the current length of the options list", ->
- $('.product_options .sortable').html('<li>foo</li><li>bar</li>')
- expect(@view.optionsLength()).toEqual 2
+ $('.product_options .sortable').html('<li class="header">foo</li><li class="option">bar</li>')
+ expect(@view.optionsLength()).toEqual 1
describe "#maximumOptions", ->
it "returns a maximum options limit stored as data in the DOM", ->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment