Let browser tests dance again.

This commit is contained in:
Martin Edenhofer 2014-12-01 21:04:37 +01:00
parent df6c2d1132
commit 1d929159ba
8 changed files with 85 additions and 74 deletions

View file

@ -30,8 +30,6 @@ class App.ControllerForm extends App.Controller
fieldset = $('<fieldset></fieldset>')
fieldset.append('<a href="#" class="js-reset hide">' + App.i18n.translatePlain('Discard your unsaved changes.') + '</a>')
# collect form attributes
@attributes = []
if @model.attributesGet

View file

@ -520,12 +520,12 @@ class App.Sidebar extends App.Controller
toggleSidebar: =>
@el.parent().find('.tabsSidebar-sidebarSpacer').toggleClass('is-closed')
@el.parent().find('.tabsSidebar').toggleClass('is-closed')
@el.parent().next('.attributeBar').toggleClass('is-closed')
#@el.parent().next('.attributeBar').toggleClass('is-closed')
showSidebar: ->
@el.parent().find('.tabsSidebar-sidebarSpacer').removeClass('is-closed')
@el.parent().find('.tabsSidebar').removeClass('is-closed')
@el.parent().next('.attributeBar').addClass('is-closed')
#@el.parent().next('.attributeBar').addClass('is-closed')
toggleTab: (e) =>

View file

@ -175,7 +175,6 @@ class App.TicketZoom extends App.Controller
@form_id = App.ControllerForm.formId()
new Edit(
ticket: @ticket
el: @el.find('.ticket-edit')
@ -189,12 +188,20 @@ class App.TicketZoom extends App.Controller
editTicket = (el) =>
el.append('<form class="edit"></form>')
@editEl = el
console.log('EDIT TAB', @ticket.id)
reset = (e) =>
e.preventDefault()
@taskReset()
show(@ticket)
new Edit(
ticket: @ticket
el: @el.find('.ticket-edit')
#el: @el.find('.edit')
form_meta: @form_meta
form_id: @form_id
defaults: @taskGet('article')
ui: @
)
show = (ticket) =>
console.log('SHOW', ticket.id)
@ -245,10 +252,10 @@ class App.TicketZoom extends App.Controller
bookmarkable: true
)
#console.log('Ichanges', modelDiff, task_state, ticket.attributes())
@markFormDiff( modelDiff )
#@markFormDiff( modelDiff )
# bind on reset link
@el.find('.edit .js-reset').on(
@$('.js-reset').on(
'click'
(e) =>
reset(e)
@ -424,7 +431,7 @@ class App.TicketZoom extends App.Controller
currentStore =
ticket: @ticket.attributes()
article: {
type: ''
type: 'note'
body: ''
internal: ''
}
@ -434,7 +441,7 @@ class App.TicketZoom extends App.Controller
# get diff of model
modelDiff =
ticket: @getDiff( currentStore.ticket, currentParams.ticket )
ticket: @getDiff( currentStore.ticket, currentParams.ticket )
article: @getDiff( currentStore.article, currentParams.article )
#console.log('modelDiff', modelDiff)
@ -446,7 +453,7 @@ class App.TicketZoom extends App.Controller
console.log('model DIFF ', modelDiff)
@autosaveLast = clone(currentParams)
@markFormDiff( modelDiff.ticket )
@markFormDiff( modelDiff )
@taskUpdateAll( modelDiff )
@interval( update, 3000, 'autosave' )
@ -464,30 +471,33 @@ class App.TicketZoom extends App.Controller
result = difference( modelClone, params )
markFormDiff: (diff = {}) =>
form = @$('.edit')
ticketForm = @$('.edit')
articleForm = @$('.article-add')
params = @formParam( form )
#console.log('markFormDiff', diff, params)
params = {}
params.ticket = @formParam( ticketForm )
params.article = @formParam( articleForm )
console.log('markFormDiff', diff, params)
# clear all changes
if _.isEmpty(diff)
form.removeClass('form-changed')
form.find('.form-group').removeClass('is-changed')
form.find('.js-reset').addClass('hide')
if _.isEmpty(diff.ticket) && _.isEmpty(diff.article)
ticketForm.removeClass('form-changed')
ticketForm.find('.form-group').removeClass('is-changed')
@$('.js-reset').addClass('hide')
# set changes
else
form.addClass('form-changed')
for currentKey, currentValue of params
ticketForm.addClass('form-changed')
for currentKey, currentValue of params.ticket
element = @$('.edit [name="' + currentKey + '"]').parents('.form-group')
if diff[currentKey]
if diff.ticket[currentKey]
if !element.hasClass('is-changed')
element.addClass('is-changed')
else
if element.hasClass('is-changed')
element.removeClass('is-changed')
form.find('.js-reset').removeClass('hide')
@$('.js-reset').removeClass('hide')
submit: (e) =>
@ -643,7 +653,7 @@ class App.TicketZoom extends App.Controller
taskReset: (area, data) =>
@localTaskData =
ticket: {}
ticket: {}
article: {}
App.TaskManager.update( @task_key, { 'state': @localTaskData })

View file

@ -53,46 +53,51 @@
<div class="tabsSidebar vertical"></div>
</div>
<form class="attributeBar form-inline is-closed" role="form">
<div class="attributeBar">
<form class="form-inline is-closed hide" role="form">
<div class="form-group">
<label for="update_ticket_1_state_id123" class="input-group-addon u-clickable">State</label>
<select id="update_ticket_1_state_id123" class="form-control level-1" name="state_id">
<option value="4">closed</option>
<option value="1" selected="">new</option>
<option value="2">open</option>
<option value="3">pending</option>
</select>
<div class="select-arrow icon"></div>
</div>
<div class="form-group is-changed">
<label for="update_ticket_1_priority_id123" class="input-group-addon u-clickable">Priority</label>
<select id="update_ticket_1_priority_id123" class="form-control" name="priority_id">
<option value="1">1 low</option>
<option value="2" selected="">2 normal</option>
<option value="3">3 high</option>
</select>
<div class="select-arrow icon"></div>
</div>
<div class="form-group">
<label for="update_ticket_1_group_id123" class="input-group-addon u-clickable">Group</label>
<select id="update_ticket_1_group_id123" class="form-control" name="group_id">
<option value="4">FillGroup::450863</option>
<option value="3">FillGroup::918672</option>
<option value="2">Twitter</option>
<option value="1" selected="">Users</option>
</select>
<div class="select-arrow icon"></div>
</div>
<div class="form-group">
<label for="update_ticket_1_owner_id123" class="input-group-addon u-clickable">Owner</label>
<select id="update_ticket_1_owner_id123" class="form-control" name="owner_id">
<option value="">-</option>
<option value="3">Felix Niklas</option>
</select>
<div class="select-arrow icon"></div>
</div>
</form>
<form class="form-inline">
<div class="form-group">
<label for="update_ticket_1_state_id123" class="input-group-addon u-clickable">State</label>
<select id="update_ticket_1_state_id123" class="form-control level-1" name="state_id">
<option value="4">closed</option>
<option value="1" selected="">new</option>
<option value="2">open</option>
<option value="3">pending</option>
</select>
<div class="select-arrow icon"></div>
<button type="submit" class="btn js-reset pull-right hide"><%- @T('Discard your unsaved changes.') %></button>
<button type="submit" class="btn btn--primary js-submit pull-right"><%- @T('Update') %></button>
</div>
<div class="form-group is-changed">
<label for="update_ticket_1_priority_id123" class="input-group-addon u-clickable">Priority</label>
<select id="update_ticket_1_priority_id123" class="form-control" name="priority_id">
<option value="1">1 low</option>
<option value="2" selected="">2 normal</option>
<option value="3">3 high</option>
</select>
<div class="select-arrow icon"></div>
</div>
<div class="form-group">
<label for="update_ticket_1_group_id123" class="input-group-addon u-clickable">Group</label>
<select id="update_ticket_1_group_id123" class="form-control" name="group_id">
<option value="4">FillGroup::450863</option>
<option value="3">FillGroup::918672</option>
<option value="2">Twitter</option>
<option value="1" selected="">Users</option>
</select>
<div class="select-arrow icon"></div>
</div>
<div class="form-group">
<label for="update_ticket_1_owner_id123" class="input-group-addon u-clickable">Owner</label>
<select id="update_ticket_1_owner_id123" class="form-control" name="owner_id">
<option value="">-</option>
<option value="3">Felix Niklas</option>
</select>
<div class="select-arrow icon"></div>
</div>
<div class="form-group">
<button type="submit" class="btn btn--primary js-submit"><%- @T('Update') %></button>
</div>
</form>
</form>
</div>
</div>

View file

@ -29,7 +29,7 @@ rake db:seed
cat config/environments/production.rb | sed -e 's/config.serve_static_assets = false/config.serve_static_assets = true/' > /tmp/production.rb && cp /tmp/production.rb config/environments/production.rb
# mofidy auth backend
cat lib/auth/test.rb | sed 's/development/production/' > /tmp/test.rb && cp /tmp/test.rb lib/auth/test.rb
cat lib/auth/test.rb | sed 's/test/production/' > /tmp/test.rb && cp /tmp/test.rb lib/auth/test.rb
pumactl --pidfile tmp/pids/puma.pid stop
script/websocket-server.rb stop

View file

@ -118,11 +118,11 @@ class AgentTicketActionLevel1Test < TestCase
:action => [
{
:execute => 'click',
:css => '.active .actions button',
:css => '.active div[data-tab="ticket"] .js-actions .select-arrow',
},
{
:execute => 'click',
:css => '.active a[data-type="merge"]',
:css => '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]',
},
{
:execute => 'wait',

View file

@ -136,7 +136,7 @@ class AgentTicketActionsLevel3Test < TestCase
{
:where => :instance1,
:execute => 'match',
:css => '.active div.ticket-article-view',
:css => '.active div.ticket-article',
:value => 'some level 3 <b>body</b> in instance 2',
:match_result => true,
},
@ -176,14 +176,14 @@ class AgentTicketActionsLevel3Test < TestCase
{
:where => :instance2,
:execute => 'match',
:css => '.active div.ticket-article-view',
:css => '.active div.ticket-article',
:value => 'some level 3 <b>body</b> in instance 1',
:match_result => true,
},
{
:where => :instance2,
:execute => 'match',
:css => '.active div.ticket-article-view',
:css => '.active div.ticket-article',
:value => 'some level 3 <b>body</b> in instance 2',
:match_result => true,
},
@ -310,7 +310,7 @@ class AgentTicketActionsLevel3Test < TestCase
{
:where => :instance2,
:execute => 'match',
:css => '.active div.ticket-article-view',
:css => '.active div.ticket-article',
:value => '22 some level 3 <b>body</b> in instance 2',
:match_result => true,
},

View file

@ -446,17 +446,15 @@ class AgentTicketActionLevel5Test < TestCase
:execute => 'click',
:css => 'a[href="#manage"]',
},
# create ticket
{
:where => :instance2,
:execute => 'click',
:css => '.content.active .tabsSidebar-tabs [data-tab="customer"]',
:css => '.active div[data-tab="ticket"] .js-actions .select-arrow',
},
{
:where => :instance2,
:execute => 'click',
:css => '.content.active .tabsSidebar [data-name="Change Customer"]',
:css => '.active div[data-tab="ticket"] .js-actions a[data-type="customer-change"]',
},
{
:execute => 'wait',