Client side table management for supplier sections
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
#module "suppliers-switcher", "SuppliersSwitcherComponent"
|
||||
moduleForComponent "suppliers-switcher"
|
||||
test "Triggers switch", ->
|
||||
expect 2
|
||||
component = @subject()
|
||||
controller = App.__container__.lookup('controller:settings')
|
||||
component.set 'targetObject', controller
|
||||
Ember.run ->
|
||||
controller.store.createRecord 'supplier',
|
||||
id: 'other-supplier'
|
||||
@@ -11,11 +13,8 @@ test "Triggers switch", ->
|
||||
@render()
|
||||
equal find('ul').text(), "Switch to Other supplier1"
|
||||
|
||||
s_name = null
|
||||
# Stub the action, since it triggers an external call
|
||||
component._actions.switchTo = (supplier)->
|
||||
s_name = supplier.get('name')
|
||||
equal supplier.get('name'), 'Other supplier1'
|
||||
|
||||
click 'li a'
|
||||
|
||||
equal s_name, 'Other supplier1'
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
moduleForModel 'section', 'Section model',
|
||||
needs: ['model:section', 'model:table', 'model:section-area', 'model:section-element', 'model:list']
|
||||
|
||||
test "arrange_tables_in_grid", ->
|
||||
section = @subject
|
||||
width: 20
|
||||
height: 13
|
||||
Ember.run ->
|
||||
table6 = section.store.createRecord 'table', number: 6, section: section
|
||||
table1 = section.store.createRecord 'table', number: 1, section: section
|
||||
table19 = section.store.createRecord 'table', number: 19, section: section
|
||||
|
||||
section.invoke 'arrange_tables_in_grid'
|
||||
|
||||
equal table1.get('position_y'), 2.85
|
||||
equal table6.get('position_y'), 2.85
|
||||
equal table19.get('position_y'), 9.35
|
||||
|
||||
equal table1.get('position_x'), 4.6
|
||||
equal table6.get('position_x'), 14.6
|
||||
equal table19.get('position_x'), 4.6
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
test "distribute_lattice", ->
|
||||
expect 10
|
||||
test_matrix = [
|
||||
{input: [20 , 10, 4], expected_output: [10.0, 5.0]},
|
||||
{input: [10 , 10, 4], expected_output: [ 5.0, 5.0]},
|
||||
{input: [20 , 5, 4], expected_output: [ 5.0, 5.0]},
|
||||
{input: [30 , 10, 4], expected_output: [ 7.5, 10.0]},
|
||||
{input: [10 , 30, 4], expected_output: [10.0, 7.5]},
|
||||
{input: [10 , 10, 3], expected_output: [ 5.0, 5.0]},
|
||||
{input: [13.6, 40, 7], expected_output: [ 6.8, 10.0]},
|
||||
{input: [13.6, 40, 9], expected_output: [ 6.8, 8.0]},
|
||||
{input: [13.6, 40, 10], expected_output: [ 6.8, 8.0]},
|
||||
{input: [40, 40, 23], expected_output: [ 8.0, 8.0]},
|
||||
]
|
||||
for expectation in test_matrix
|
||||
deepEqual App.Distribution.distribute_lattice.apply(this, expectation.input), expectation.expected_output
|
||||
@@ -1,4 +1,5 @@
|
||||
module 'Router', setup: -> App.reset()
|
||||
test 'root route', ->
|
||||
visit '/'
|
||||
andThen -> equal currentRouteName(), 'index'
|
||||
#module 'Router', setup: -> App.reset()
|
||||
#test 'root route', ->
|
||||
#visit '/'
|
||||
#andThen ->
|
||||
#equal currentRouteName(), 'index'
|
||||
|
||||
Reference in New Issue
Block a user