Fixed unit tests.

This commit is contained in:
Martin Edenhofer 2014-08-14 11:04:02 +02:00
parent 2a3aef0ca6
commit 4c903bfd4a
3 changed files with 118 additions and 8 deletions

View file

@ -150,14 +150,6 @@ class App.TicketZoom extends App.Controller
if !@editWidget || _.isEmpty( App.TaskManager.get(@task_key).state )
@editWidget = @Edit()
# show text module UI
if !@isRole('Customer')
new App.WidgetTextModule(
el: @el.find('textarea')
data:
ticket: @ticket
)
# scroll to article if given
if @article_id && document.getElementById( 'article-' + @article_id )
offset = document.getElementById( 'article-' + @article_id ).offsetTop
@ -324,6 +316,8 @@ class Edit extends App.Controller
release: =>
@autosaveStop()
if @subscribeIdTextModule
App.Ticket.unsubscribe(@subscribeIdTextModule)
render: ->
@ -422,6 +416,19 @@ class Edit extends App.Controller
# enable user popups
@userPopups()
# show text module UI
if !@isRole('Customer')
textModule = new App.WidgetTextModule(
el: @el.find('textarea')
data:
ticket: ticket
)
callback = (ticket) =>
textModule.reload(
ticket: ticket
)
@subscribeIdTextModule = ticket.subscribe( callback )
autosaveStop: =>
@clearInterval( 'autosave' )

View file

@ -14,6 +14,10 @@ class App.WidgetUser extends App.ControllerDrox
render: (user) =>
# execute callback on render/rerender
if @callback
@callback(user)
# get display data
userData = []
for item2 in App.User.configure_attributes

View file

@ -433,6 +433,105 @@ class TextModuleTest < TestCase
},
],
},
{
:name => 'change customer',
:action => [
# create ticket
{
:where => :instance2,
:execute => 'click',
:css => '.active .action button',
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'click',
:css => '.active .action [data-type="customer"]',
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'set',
:css => '#form-customer input[name="customer_id_autocompletion"]',
:value => 'agent',
},
{
:execute => 'wait',
:value => 4,
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '#form-customer input[name="customer_id_autocompletion"]',
:value => :arrow_down,
},
{
:where => :instance2,
:execute => 'sendkey',
:css => '#form-customer input[name="customer_id_autocompletion"]',
:value => :tab,
},
{
:where => :instance2,
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'click',
:css => '.modal-content [type="submit"]',
},
{
:where => :instance2,
:execute => 'wait',
:value => 4,
},
{
:where => :instance2,
:execute => 'set',
:css => '.active textarea[name=body]',
:value => '::' + random,
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'match',
:css => 'body',
:value => random,
:match_result => true,
},
{
:where => :instance2,
:execute => 'click',
:css => '.-sew-list-item.selected',
},
{
:execute => 'wait',
:value => 1,
},
{
:where => :instance2,
:execute => 'match',
:css => '.active textarea[name=body]',
:value => 'some content .+?Manag.+?' + random,
:no_quote => true,
:match_result => true,
},
],
},
]
browser_double_test(tests)
end