Better section actions speccing
This commit is contained in:
@@ -21,14 +21,14 @@
|
|||||||
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}" {{t 'tables.qr_codes.link'}}
|
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}" {{t 'tables.qr_codes.link'}}
|
||||||
li
|
li
|
||||||
a href="{{route 'suppliers_section_path' id}}" data-method="delete" data-confirm="{{t 'helpers.links.are_you_sure' bare=true}}" {{t 'helpers.links.destroy'}}
|
a href="{{route 'suppliers_section_path' id}}" data-method="delete" data-confirm="{{t 'helpers.links.are_you_sure' bare=true}}" {{t 'helpers.links.destroy'}}
|
||||||
view Ember.TextField valueBinding="title"
|
view Ember.TextField valueBinding="title" class="section-edit-title-field"
|
||||||
view Ember.TextField valueBinding="width" classNames="dimension"
|
view Ember.TextField valueBinding="width" class="dimension section-edit-width-field"
|
||||||
span x
|
span x
|
||||||
view Ember.TextField valueBinding="height" classNames="dimension"
|
view Ember.TextField valueBinding="height" class="dimension section-edit-height-field"
|
||||||
a.btn.btn-mini{ action finishEditable }
|
a.btn.btn-mini.section-normal-mode-button{ action finishEditable }
|
||||||
span.icon-ok
|
span.icon-ok
|
||||||
else
|
else
|
||||||
a.btn.btn-mini{ action makeEditable }
|
a.btn.btn-mini.section-edit-mode-button{ action makeEditable }
|
||||||
span.icon-pencil
|
span.icon-pencil
|
||||||
each table in tables
|
each table in tables
|
||||||
view 'Qsupplier.App.SectionTableView' contentBinding="table"
|
view 'Qsupplier.App.SectionTableView' contentBinding="table"
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ Qsupplier.App.SectionTabHeaderView = Ember.View.extend DragNDrop.Droppable,
|
|||||||
template: Ember.Handlebars.compile('{{view.content.title}}')
|
template: Ember.Handlebars.compile('{{view.content.title}}')
|
||||||
tagName: 'a'
|
tagName: 'a'
|
||||||
attributeBindings: ['href']
|
attributeBindings: ['href']
|
||||||
|
classNameBindings: ['section_header_class']
|
||||||
|
|
||||||
|
section_header_class: (-> "section-tab-header-#{@get('content.id')}").property()
|
||||||
href: (-> Routes.suppliers_section_path(@content.id)).property()
|
href: (-> Routes.suppliers_section_path(@content.id)).property()
|
||||||
dragEntered: (view)->
|
dragEntered: (view)->
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -46,3 +46,30 @@ Feature: Supplier section view
|
|||||||
When I reset the section selector in the supplier dashboard
|
When I reset the section selector in the supplier dashboard
|
||||||
Then I should see the list and the new list
|
Then I should see the list and the new list
|
||||||
And I should see the order and the new order
|
And I should see the order and the new order
|
||||||
|
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Going to edit mode and change section properties
|
||||||
|
Given there is an active list and order
|
||||||
|
And there are 2 supplier sections
|
||||||
|
And the last supplier section has a table with known coordinates
|
||||||
|
And I am signed in as supplier
|
||||||
|
When I visit the supplier last section path
|
||||||
|
And I click the supplier section edit mode button
|
||||||
|
And I fill in the supplier edit section form with new values
|
||||||
|
Then the last section tab header should have the newly filled in name
|
||||||
|
When I click the supplier section normal mode button
|
||||||
|
Then the supplier last section properties should be updated to the new values
|
||||||
|
|
||||||
|
# capybara-webkit 1.1.0 drag to is not yet supported it seems
|
||||||
|
@javascript @broken
|
||||||
|
Scenario: Dragging a table to another section
|
||||||
|
Given there is an active list and order
|
||||||
|
And there are 2 supplier sections
|
||||||
|
And the last supplier section has a table with known coordinates
|
||||||
|
And I am signed in as supplier
|
||||||
|
When I visit the supplier last section path
|
||||||
|
And I click the supplier section edit mode button
|
||||||
|
And I drag the table from the last section to the first section tab header
|
||||||
|
And I wait 1 second
|
||||||
|
Then the supplier table should have been linked to the first section
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ step "I visit the supplier section path" do
|
|||||||
visit "/supplier/sections/#{@section.id}"
|
visit "/supplier/sections/#{@section.id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
step "I visit the supplier last section path" do
|
||||||
|
visit "/supplier/sections/#{@sections.last.id}"
|
||||||
|
end
|
||||||
|
|
||||||
step "I should be redirected to the supplier settings page" do
|
step "I should be redirected to the supplier settings page" do
|
||||||
#page.current_path.should == supplier_settings_path
|
#page.current_path.should == supplier_settings_path
|
||||||
|
|||||||
@@ -70,3 +70,45 @@ step "I should be redirected to the supplier section view" do
|
|||||||
#page.current_path.should == "/supplier/sections/#{@section.id}"
|
#page.current_path.should == "/supplier/sections/#{@section.id}"
|
||||||
page.evaluate_script('window.location.pathname').should == "/supplier/sections/#{@section.id}"
|
page.evaluate_script('window.location.pathname').should == "/supplier/sections/#{@section.id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
step "the last supplier section has a table with known coordinates" do
|
||||||
|
@table = create :table, position_x: 4, position_y: 5, number: 74, supplier: @supplier, section: @sections.last
|
||||||
|
end
|
||||||
|
|
||||||
|
step "I click the supplier section edit mode button" do
|
||||||
|
find('.section-edit-mode-button').click
|
||||||
|
end
|
||||||
|
|
||||||
|
step "I click the supplier section normal mode button" do
|
||||||
|
find('.section-normal-mode-button').click
|
||||||
|
end
|
||||||
|
|
||||||
|
step "I fill in the supplier edit section form with new values" do
|
||||||
|
find('.section-edit-title-field').set 'RenamedSection'
|
||||||
|
find('.section-edit-width-field').set '40'
|
||||||
|
find('.section-edit-height-field').set '52.7'
|
||||||
|
end
|
||||||
|
|
||||||
|
step "the last section tab header should have the newly filled in name" do
|
||||||
|
find(".section-tab-header-#{@sections.last.id}").text.should == 'RenamedSection'
|
||||||
|
end
|
||||||
|
|
||||||
|
step "the supplier last section properties should be updated to the new values" do
|
||||||
|
sleep 1
|
||||||
|
section = @sections.last
|
||||||
|
section.reload
|
||||||
|
section.title.should == 'RenamedSection'
|
||||||
|
section.width.should == 40.0
|
||||||
|
section.height.should == 52.7
|
||||||
|
end
|
||||||
|
|
||||||
|
step "I drag the table from the last section to the first section tab header" do
|
||||||
|
first_section_tab_header = find(".section-tab-header-#{@sections.first.id}")
|
||||||
|
table_view = find(".section-table-#{@table.id}")
|
||||||
|
table_view.drag_to first_section_tab_header
|
||||||
|
end
|
||||||
|
|
||||||
|
step "the supplier table should have been linked to the first section" do
|
||||||
|
@table.reload
|
||||||
|
@table.section_id.should == @sections.first.id
|
||||||
|
end
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ Dir.glob("spec/acceptance_steps/**/*steps.rb") { |f| load f, true }
|
|||||||
I18n.locale =I18n.default_locale
|
I18n.locale =I18n.default_locale
|
||||||
Devise.stretches = 1
|
Devise.stretches = 1
|
||||||
Capybara.javascript_driver = :webkit
|
Capybara.javascript_driver = :webkit
|
||||||
|
Capybara.default_wait_time = 4 # ember needs more time than the default of 2
|
||||||
#Capybara.javascript_driver = :selenium
|
#Capybara.javascript_driver = :selenium
|
||||||
|
|
||||||
module FactoryAttributesFor
|
module FactoryAttributesFor
|
||||||
|
|||||||
Reference in New Issue
Block a user