Let browser tests dance again.
This commit is contained in:
parent
df6c2d1132
commit
1d929159ba
8 changed files with 85 additions and 74 deletions
|
@ -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
|
||||
|
|
|
@ -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) =>
|
||||
|
||||
|
|
|
@ -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: ''
|
||||
}
|
||||
|
@ -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) =>
|
||||
|
|
|
@ -53,7 +53,8 @@
|
|||
<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">
|
||||
|
@ -91,8 +92,12 @@
|
|||
</select>
|
||||
<div class="select-arrow icon"></div>
|
||||
</div>
|
||||
</form>
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn--primary js-submit"><%- @T('Update') %></button>
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
|
@ -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
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue