Merge branch 'master' into bom

This commit is contained in:
Rob H
2014-03-21 13:47:50 +11:00
129 changed files with 1603 additions and 1629 deletions

View File

@@ -690,6 +690,21 @@ describe "AdminProductEditCtrl", ->
variant_unit_scale: 1000
variant_unit_with_scale: 'volume_1000'
it "extracts a null value into null variant_unit and variant_unit_scale", ->
testProduct =
id: 1
variant_unit: 'weight'
variant_unit_scale: 1
variant_unit_with_scale: null
scope.packProduct(testProduct)
expect(testProduct).toEqual
id: 1
variant_unit: null
variant_unit_scale: null
variant_unit_with_scale: null
it "extracts when variant_unit_with_scale is 'items'", ->
testProduct =
id: 1

View File

@@ -0,0 +1,34 @@
describe "CheckoutCtrl", ->
ctrl = null
scope = null
order = null
beforeEach ->
module("Darkswarm")
order =
id: 3102
shipping_method_id: "7"
ship_address_same_as_billing: true
payment_method_id: null
shipping_methods:
7:
require_ship_address: true
price: 0.0
25:
require_ship_address: false
price: 13
inject ($controller) ->
scope = {}
ctrl = $controller 'CheckoutCtrl', {$scope: scope, order: order}
it 'Gets the ship address automatically', ->
expect(scope.require_ship_address).toEqual true
it 'Gets the current shipping price', ->
expect(scope.shippingPrice()).toEqual 0.0
scope.order.shipping_method_id = 25
expect(scope.shippingPrice()).toEqual 13

View File

@@ -0,0 +1,18 @@
describe 'OrderCycleCtrl', ->
ctrl = null
scope = null
event = null
product_ctrl = null
OrderCycle = null
beforeEach ->
module 'Darkswarm'
scope = {}
OrderCycle =
order_cycle: "test"
inject ($controller) ->
scope = {}
ctrl = $controller 'OrderCycleCtrl', {$scope: scope, OrderCycle: OrderCycle}
it "puts the order cycle in scope", ->
expect(scope.order_cycle).toEqual "test"

View File

@@ -6,7 +6,7 @@ describe 'All controllers', ->
Product = null
beforeEach ->
module('Shop')
module('Darkswarm')
Product =
all: ->
update: ->
@@ -40,9 +40,8 @@ describe 'All controllers', ->
OrderCycle = null
beforeEach ->
module 'Shop'
module 'Darkswarm'
scope = {}
inject ($controller) ->
scope = {}
ctrl = $controller 'OrderCycleCtrl', {$scope: scope}

View File

@@ -0,0 +1,24 @@
describe "SidebarCtrl", ->
ctrl = null
scope = null
location = null
beforeEach ->
module("Darkswarm")
location =
path: ->
"/test"
inject ($controller, $rootScope) ->
scope = $rootScope
ctrl = $controller 'SidebarCtrl', {$scope: scope, $location: location}
scope.$apply()
it 'tracks the active sidebar from the $location', ->
expect(scope.active_sidebar).toEqual "/test"
it 'is active when a location is set', ->
expect(scope.active()).toEqual "active"
it 'is inactive no location is set', ->
scope.active_sidebar = null
expect(scope.active()).toEqual null

View File

@@ -6,8 +6,8 @@ describe 'OrderCycle service', ->
}
beforeEach ->
angular.module('Shop').value('orderCycleData', {})
module 'Shop', ($provide)->
angular.module('Darkswarm').value('orderCycleData', {})
module 'Darkswarm', ($provide)->
$provide.value "Product", mockProduct
null # IMPORTANT
# You must return null because module() is a bit dumb

View File

@@ -3,7 +3,7 @@ describe 'Product service', ->
Product = null
beforeEach ->
module 'Shop'
module 'Darkswarm'
inject ($injector, _$httpBackend_)->
Product = $injector.get("Product")
$httpBackend = _$httpBackend_