diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee
index 883ac4451..58d4ead54 100644
--- a/app/assets/javascripts/app/controllers/_application_controller_generic.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller_generic.coffee
@@ -1137,18 +1137,16 @@ class App.ObserverController extends App.Controller
#console.trace()
@log 'debug', 'new', @object_id, @model
- object = App[@model].fullLocal(@object_id)
- if !object
- App[@model].full(@object_id, @maybeRender)
+ if App[@model].exists(@object_id)
+ @maybeRender( App[@model].fullLocal(@object_id) )
else
- @maybeRender(object)
+ App[@model].full(@object_id, @maybeRender)
# rerender, e. g. on language change
if @globalRerender
@bind('ui:rerender', =>
@lastAttributres = undefined
- object = App[@model].fullLocal(@object_id)
- @maybeRender(object)
+ @maybeRender( App[@model].fullLocal(@object_id) )
)
subscribe: (object, typeOfChange) =>
diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.coffee
index cb5af2292..7c6d58e6d 100644
--- a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.coffee
+++ b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.coffee
@@ -41,7 +41,6 @@ class App.TicketZoomSidebar extends App.ObserverController
organization_id: true
render: (ticket) =>
-
editTicket = (el) =>
el.append('
')
@@ -91,7 +90,7 @@ class App.TicketZoomSidebar extends App.ObserverController
callback: editTicket
}
]
- if !@permissionCheck('ticket.customer')
+ if @permissionCheck('ticket.agent')
@sidebarItems[0]['actions'] = [
{
name: 'ticket-history'
@@ -109,7 +108,7 @@ class App.TicketZoomSidebar extends App.ObserverController
callback: changeCustomer
},
]
- if !@permissionCheck('ticket.customer')
+ if @permissionCheck('ticket.agent')
editCustomer = (e, el) =>
new App.ControllerGenericEdit(
id: ticket.customer_id
diff --git a/app/assets/javascripts/app/lib/spine/spine.coffee b/app/assets/javascripts/app/lib/spine/spine.coffee
index 93ba07343..129e45bf6 100644
--- a/app/assets/javascripts/app/lib/spine/spine.coffee
+++ b/app/assets/javascripts/app/lib/spine/spine.coffee
@@ -490,7 +490,7 @@ class Model extends Module
trigger: ->
Events.trigger.apply this, arguments # fire off the instance event
- return true if arguments[0] is 'refresh' # Don't trigger refresh events, because ... ?
+ #return true if arguments[0] is 'refresh' # Don't trigger refresh events, because ... ?
@constructor.trigger arguments... # fire off the class event
Model::on = Model::bind
diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee
index 8e2e28ee9..7f420daef 100644
--- a/app/assets/javascripts/app/models/_application_model.coffee
+++ b/app/assets/javascripts/app/models/_application_model.coffee
@@ -414,8 +414,7 @@ class App.Model extends Spine.Model
App.Log.debug('Model', "local change #{@className}", items)
for item in items
for key, callback of App[ @className ].SUBSCRIPTION_ITEM[ item.id ]
- item = App[ @className ]._fillUp(item)
- callback(item, 'change')
+ callback(App[ @className ]._fillUp(item), 'change')
)
@bind(
'destroy'
@@ -427,8 +426,7 @@ class App.Model extends Spine.Model
App.Log.debug('Model', "local destroy #{@className}", items)
for item in items
for key, callback of App[ @className ].SUBSCRIPTION_ITEM[ item.id ]
- item = App[ @className ]._fillUp(item)
- callback(item, 'destroy')
+ callback(App[ @className ]._fillUp(item), 'destroy')
)
@changeTable = {}
@@ -444,10 +442,9 @@ class App.Model extends Spine.Model
for key, callback of App[ @className ].SUBSCRIPTION_ITEM[ item.id ]
# only trigger callbacks if object has changed
- if !@changeTable[key] || @changeTable[key] isnt item.updated_at
+ if !@changeTable[key] || @changeTable[key] < item.updated_at
@changeTable[key] = item.updated_at
- item = App[ @className ]._fillUp(item)
- callback(item, 'refresh')
+ callback(App[@className]._fillUp(item), 'refresh')
)
# subscribe and render data after server change
diff --git a/public/assets/tests/core.js b/public/assets/tests/core.js
index 0dd16a439..2cfcbc0ab 100644
--- a/public/assets/tests/core.js
+++ b/public/assets/tests/core.js
@@ -6,14 +6,14 @@ App.Ajax.request({
url: '/assets/tests/ajax-test.json',
success: function (data) {
test( "ajax get 200", function() {
- ok( true, "File found!" );
- equal( data.success, true, "content parsable and ok!" );
- equal( data.success2, undefined, "content parsable and ok!" );
+ ok( true, "File found!")
+ equal(data.success, true, "content parsable and ok!")
+ equal(data.success2, undefined, "content parsable and ok!")
});
},
error: function (data) {
test( "ajax", function() {
- ok( false, "Failed!" );
+ ok( false, "Failed!")
});
}
});
@@ -27,15 +27,15 @@ App.Ajax.request({
test( "ajax - queue - ajax get 200 1/2", function() {
// check queue
- ok( !window.testAjax, 'ajax - queue - check queue' );
+ ok( !window.testAjax, 'ajax - queue - check queue')
window.testAjax = true;
- equal( data.success, true, "ajax - queue - content parsable and ok!" );
- equal( data.success2, undefined, "ajax - queue - content parsable and ok!" );
+ equal(data.success, true, "ajax - queue - content parsable and ok!")
+ equal(data.success2, undefined, "ajax - queue - content parsable and ok!")
});
},
error: function (data) {
test( "ajax", function() {
- ok( false, "Failed!" );
+ ok( false, "Failed!")
});
}
});
@@ -46,16 +46,16 @@ App.Ajax.request({
success: function (data) {
test( "ajax - queue - ajax get 200 2/2", function() {
// check queue
- ok( window.testAjax, 'ajax - queue - check queue' )
+ ok( window.testAjax, 'ajax - queue - check queue')
window.testAjax = undefined;
- equal( data.success, true, "content parsable and ok!" );
- equal( data.success2, undefined, "content parsable and ok!" );
+ equal(data.success, true, "content parsable and ok!")
+ equal(data.success2, undefined, "content parsable and ok!")
});
},
error: function (data) {
test( "ajax", function() {
- ok( false, "Failed!" );
+ ok( false, "Failed!")
});
}
});
@@ -68,15 +68,15 @@ App.Ajax.request({
test( "ajax - parallel - ajax get 200 1/2", function() {
// check queue
- ok( window.testAjaxQ, 'ajax - parallel - check queue' );
+ ok( window.testAjaxQ, 'ajax - parallel - check queue')
window.testAjaxQ = undefined;
- equal( data.success, true, "ajax - parallel - content parsable and ok!" );
- equal( data.success2, undefined, "ajax - parallel - content parsable and ok!" );
+ equal(data.success, true, "ajax - parallel - content parsable and ok!")
+ equal(data.success2, undefined, "ajax - parallel - content parsable and ok!")
});
},
error: function (data) {
test( "ajax", function() {
- ok( false, "Failed!" );
+ ok( false, "Failed!")
});
}
});
@@ -86,27 +86,27 @@ App.Ajax.request({
success: function (data) {
test( "ajax - parallel - ajax get 200 2/2", function() {
// check queue
- ok( !window.testAjaxQ, 'ajax - parallel - check queue' )
+ ok( !window.testAjaxQ, 'ajax - parallel - check queue')
window.testAjaxQ = true;
- equal( data.success, true, "content parsable and ok!" );
- equal( data.success2, undefined, "content parsable and ok!" );
+ equal(data.success, true, "content parsable and ok!")
+ equal(data.success2, undefined, "content parsable and ok!")
});
},
error: function (data) {
test( "ajax", function() {
- ok( false, "Failed!" );
+ ok( false, "Failed!")
});
}
});
// delay
window.testDelay1 = false
-App.Delay.set( function() {
- test( "delay - test 1 - 1/3 - should not be executed, will be reset by next set()", function() {
+App.Delay.set(function() {
+ test('delay - test 1 - 1/3 - should not be executed, will be reset by next set()', function() {
// check
- ok( false, 'delay - test 1 - 1/3 - should not be executed, will be reset by next set()' );
+ ok(false, 'delay - test 1 - 1/3 - should not be executed, will be reset by next set()')
window.testDelay1 = true;
});
},
@@ -114,11 +114,11 @@ App.Delay.set( function() {
'delay-test1',
'level'
);
-App.Delay.set( function() {
- test( "delay - test 1 - 2/3", function() {
+App.Delay.set(function() {
+ test('delay - test 1 - 2/3', function() {
// check
- ok( !window.testDelay1, 'delay - test 1 - 2/3' );
+ ok(!window.testDelay1, 'delay - test 1 - 2/3')
window.testDelay1 = 1;
});
},
@@ -126,11 +126,11 @@ App.Delay.set( function() {
'delay-test1',
'level'
);
-App.Delay.set( function() {
- test( "delay - test 1 - 2/3", function() {
+App.Delay.set(function() {
+ test('delay - test 1 - 2/3', function() {
// check
- ok( window.testDelay1, 'delay - test 1 - 2/3' );
+ ok(window.testDelay1, 'delay - test 1 - 2/3')
window.testDelay1 = false;
});
},
@@ -139,41 +139,41 @@ App.Delay.set( function() {
'level'
);
-App.Delay.set( function() {
- test( "delay - test 2 - 1/3", function() {
+App.Delay.set(function() {
+ test('delay - test 2 - 1/3', function() {
// check
- ok( !window.testDelay2, 'delay - test 2 - 1/3' );
+ ok(!window.testDelay2, 'delay - test 2 - 1/3')
window.testDelay2 = 1;
});
},
2000
);
-App.Delay.set( function() {
- test( "delay - test 2 - 2/3", function() {
+App.Delay.set(function() {
+ test('delay - test 2 - 2/3', function() {
// check
- ok( !window.testDelay2, 'delay - test 2 - 2/3' );
+ ok(!window.testDelay2, 'delay - test 2 - 2/3')
});
},
1000
);
-App.Delay.set( function() {
- test( "delay - test 2 - 3/3", function() {
+App.Delay.set(function() {
+ test('delay - test 2 - 3/3', function() {
// check
- ok( window.testDelay2, 'delay - test 2 - 3/3' );
+ ok(window.testDelay2, 'delay - test 2 - 3/3')
});
},
3000
);
window.testDelay3 = 1;
-App.Delay.set( function() {
- test( "delay - test 3 - 1/1", function() {
+App.Delay.set(function() {
+ test('delay - test 3 - 1/1', function() {
// check
- ok( false, 'delay - test 3 - 1/1' );
+ ok(false, 'delay - test 3 - 1/1')
});
},
1000,
@@ -181,11 +181,11 @@ App.Delay.set( function() {
);
App.Delay.clear('delay3')
-App.Delay.set( function() {
- test( "delay - test 4 - 1/1", function() {
+App.Delay.set(function() {
+ test('delay - test 4 - 1/1', function() {
// check
- ok( false, 'delay - test 4 - 1/1' );
+ ok(false, 'delay - test 4 - 1/1')
});
},
1000,
@@ -197,27 +197,27 @@ App.Delay.clearLevel('Page')
// interval 1
window.testInterval1 = 1
-App.Interval.set( function() {
+App.Interval.set(function() {
window.testInterval1 += 1;
},
2000,
'interval-test1'
);
-App.Delay.set( function() {
- test( "interval - test 1 - 1/2", function() {
+App.Delay.set(function() {
+ test('interval - test 1 - 1/2', function() {
// check
- equal( window.testInterval1, 4, 'interval - test 1' );
+ equal(window.testInterval1, 4, 'interval - test 1')
App.Interval.clear('interval-test1')
});
},
5200
);
-App.Delay.set( function() {
- test( "interval - test 1 - 2/2", function() {
+App.Delay.set(function() {
+ test('interval - test 1 - 2/2', function() {
// check
- equal( window.testInterval1, 4, 'interval - test after clear' );
+ equal(window.testInterval1, 4, 'interval - test after clear')
});
},
6500
@@ -226,28 +226,28 @@ App.Delay.set( function() {
// interval 2
window.testInterval2 = 1
-App.Interval.set( function() {
+App.Interval.set(function() {
window.testInterval2 += 1;
},
2000,
undefined,
'someLevel'
);
-App.Delay.set( function() {
- test( "interval - test 2 - 1/2", function() {
+App.Delay.set(function() {
+ test('interval - test 2 - 1/2', function() {
// check
- equal( window.testInterval2, 4, 'interval - test 2' );
+ equal(window.testInterval2, 4, 'interval - test 2')
App.Interval.clearLevel('someLevel')
});
},
5200
);
-App.Delay.set( function() {
- test( "interval - test 2 - 2/2", function() {
+App.Delay.set(function() {
+ test('interval - test 2 - 2/2', function() {
// check
- equal( window.testInterval2, 4, 'interval - test 2 - after clear' );
+ equal(window.testInterval2, 4, 'interval - test 2 - after clear')
});
},
6900
@@ -255,190 +255,190 @@ App.Delay.set( function() {
// i18n
-test( "i18n", function() {
+test('i18n', function() {
// de
- App.i18n.set('de-de');
- var translated = App.i18n.translateContent('yes');
- equal( translated, 'ja', 'de-de - yes / ja translated correctly' );
+ App.i18n.set('de-de')
+ var translated = App.i18n.translateContent('yes')
+ equal(translated, 'ja', 'de-de - yes / ja translated correctly')
- translated = App.i18n.translatePlain('yes');
- equal( translated, 'ja', 'de-de - yes / ja translated correctly' );
+ translated = App.i18n.translatePlain('yes')
+ equal(translated, 'ja', 'de-de - yes / ja translated correctly')
- translated = App.i18n.translateInline('yes');
- equal( translated, 'ja', 'de-de - yes / ja translated correctly' );
+ translated = App.i18n.translateInline('yes')
+ equal(translated, 'ja', 'de-de - yes / ja translated correctly')
translated = App.i18n.translateContent('%s ago', 123);
- equal( translated, 'vor 123', 'de-de - %s' );
+ equal(translated, 'vor 123', 'de-de - %s')
- translated = App.i18n.translateContent('%s ago', 'quote');
- equal( translated, 'vor <b>quote</b>', 'de-de - %s - quote' );
+ translated = App.i18n.translateContent('%s ago', 'quote')
+ equal(translated, 'vor <b>quote</b>', 'de-de - %s - quote')
- translated = App.i18n.translateContent('%s %s test', 123, 'xxx |B|');
- equal( translated, '123 xxx |B| test', 'de-de - %s %s' );
+ translated = App.i18n.translateContent('%s %s test', 123, 'xxx |B|')
+ equal(translated, '123 xxx |B| test', 'de-de - %s %s')
- translated = App.i18n.translateContent('|%s| %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'de-de - *%s* %s' );
+ translated = App.i18n.translateContent('|%s| %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'de-de - *%s* %s')
- translated = App.i18n.translateContent('||%s|| %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'de-de - *%s* %s' );
+ translated = App.i18n.translateContent('||%s|| %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'de-de - *%s* %s')
- translated = App.i18n.translateContent('_%s_ %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'de-de - _%s_ %s' );
+ translated = App.i18n.translateContent('_%s_ %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'de-de - _%s_ %s')
- translated = App.i18n.translateContent('§%s§ %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'de-de - §%s§ %s' );
+ translated = App.i18n.translateContent('§%s§ %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'de-de - §%s§ %s')
- translated = App.i18n.translateContent('//%s// %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'de-de - //%s// %s' );
+ translated = App.i18n.translateContent('//%s// %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'de-de - //%s// %s')
- translated = App.i18n.translateContent('\'%s\' %s test', 123, 'xxx');
- equal( translated, ''123' xxx test', 'de-de - \'%s\' %s' );
+ translated = App.i18n.translateContent('\'%s\' %s test', 123, 'xxx')
+ equal(translated, ''123' xxx test', 'de-de - \'%s\' %s')
- translated = App.i18n.translateContent('//*äöüß');
- equal( translated, '<test&now>//*äöüß', 'de - //*äöüß' );
+ translated = App.i18n.translateContent('//*äöüß')
+ equal(translated, '<test&now>//*äöüß', 'de - //*äöüß')
- translated = App.i18n.translateContent('some link [to what ever](http://lalala)');
- equal( translated, 'some link to what ever', 'de-de - link' );
+ translated = App.i18n.translateContent('some link [to what ever](http://lalala)')
+ equal(translated, 'some link to what ever', 'de-de - link')
- translated = App.i18n.translateContent('some link [to what ever](%s)', 'http://lalala');
- equal( translated, 'some link to what ever', 'de-de - link' );
+ translated = App.i18n.translateContent('some link [to what ever](%s)', 'http://lalala')
+ equal(translated, 'some link to what ever', 'de-de - link')
- translated = App.i18n.translateContent('Enables user authentication via %s. Register your app first at [%s](%s).', 'XXX', 'YYY', 'http://lalala');
- equal( translated, 'Aktivieren der Benutzeranmeldung über XXX. Registriere Deine Anwendung zuerst über YYY.', 'en-us - link' );
+ translated = App.i18n.translateContent('Enables user authentication via %s. Register your app first at [%s](%s).', 'XXX', 'YYY', 'http://lalala')
+ equal(translated, 'Aktivieren der Benutzeranmeldung über XXX. Registriere Deine Anwendung zuerst über YYY.', 'en-us - link')
var time_local = new Date();
var offset = time_local.getTimezoneOffset();
var timestamp = App.i18n.translateTimestamp('2012-11-06T21:07:24Z', offset);
- equal( timestamp, '06.11.2012 21:07', 'de-de - timestamp translated correctly' );
+ equal(timestamp, '06.11.2012 21:07', 'de-de - timestamp translated correctly')
// en
- App.i18n.set('en-us');
- translated = App.i18n.translateContent('yes');
- equal( translated, 'yes', 'en-us - yes translated correctly' );
+ App.i18n.set('en-us')
+ translated = App.i18n.translateContent('yes')
+ equal(translated, 'yes', 'en-us - yes translated correctly')
- translated = App.i18n.translatePlain('yes');
- equal( translated, 'yes', 'en-us - yes translated correctly' );
+ translated = App.i18n.translatePlain('yes')
+ equal(translated, 'yes', 'en-us - yes translated correctly')
- translated = App.i18n.translateInline('yes');
- equal( translated, 'yes', 'en-us - yes translated correctly' );
+ translated = App.i18n.translateInline('yes')
+ equal(translated, 'yes', 'en-us - yes translated correctly')
translated = App.i18n.translateContent('%s ago', 123);
- equal( translated, '123 ago', 'en-us - %s' );
+ equal(translated, '123 ago', 'en-us - %s')
- translated = App.i18n.translateContent('%s ago', 'quote');
- equal( translated, '<b>quote</b> ago', 'en-us - %s - qupte' );
+ translated = App.i18n.translateContent('%s ago', 'quote')
+ equal(translated, '<b>quote</b> ago', 'en-us - %s - qupte')
- translated = App.i18n.translateContent('%s %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'en-us - %s %s' );
+ translated = App.i18n.translateContent('%s %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'en-us - %s %s')
- translated = App.i18n.translateContent('|%s| %s test', 123, 'xxx |B|');
- equal( translated, '123 xxx |B| test', 'en-us - *%s* %s' );
+ translated = App.i18n.translateContent('|%s| %s test', 123, 'xxx |B|')
+ equal(translated, '123 xxx |B| test', 'en-us - *%s* %s')
- translated = App.i18n.translateContent('||%s|| %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'en-us - *%s* %s' );
+ translated = App.i18n.translateContent('||%s|| %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'en-us - *%s* %s')
- translated = App.i18n.translateContent('_%s_ %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'en-us - _%s_ %s' );
+ translated = App.i18n.translateContent('_%s_ %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'en-us - _%s_ %s')
- translated = App.i18n.translateContent('§%s§ %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'en-us - §%s§ %s' );
+ translated = App.i18n.translateContent('§%s§ %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'en-us - §%s§ %s')
- translated = App.i18n.translateContent('Here you can search for ticket, customers and organizations. Use the wildcard §*§ to find everything. E. g. §smi*§ or §rosent*l§. You also can use ||double quotes|| for searching phrases §"some phrase"§.');
- equal( translated, 'Here you can search for ticket, customers and organizations. Use the wildcard * to find everything. E. g. smi* or rosent*l. You also can use double quotes for searching phrases "some phrase".', 'en-us - §§ §§ §§ || §§' );
+ translated = App.i18n.translateContent('Here you can search for ticket, customers and organizations. Use the wildcard §*§ to find everything. E. g. §smi*§ or §rosent*l§. You also can use ||double quotes|| for searching phrases §"some phrase"§.')
+ equal(translated, 'Here you can search for ticket, customers and organizations. Use the wildcard * to find everything. E. g. smi* or rosent*l. You also can use double quotes for searching phrases "some phrase".', 'en-us - §§ §§ §§ || §§')
- translated = App.i18n.translateContent('//%s// %s test', 123, 'xxx');
- equal( translated, '123 xxx test', 'en-us - //%s// %s' );
+ translated = App.i18n.translateContent('//%s// %s test', 123, 'xxx')
+ equal(translated, '123 xxx test', 'en-us - //%s// %s')
- translated = App.i18n.translateContent('\'%s\' %s test', 123, 'xxx');
- equal( translated, ''123' xxx test', 'en-us - \'%s\' %s' );
+ translated = App.i18n.translateContent('\'%s\' %s test', 123, 'xxx')
+ equal(translated, ''123' xxx test', 'en-us - \'%s\' %s')
- translated = App.i18n.translateContent('');
- equal( translated, '<test&now>', 'en-us - ' );
+ translated = App.i18n.translateContent('')
+ equal(translated, '<test&now>', 'en-us - ')
- translated = App.i18n.translateContent('some link [to what ever](http://lalala)');
- equal( translated, 'some link to what ever', 'en-us - link' );
+ translated = App.i18n.translateContent('some link [to what ever](http://lalala)')
+ equal(translated, 'some link to what ever', 'en-us - link')
- translated = App.i18n.translateContent('some link [to what ever](%s)', 'http://lalala');
- equal( translated, 'some link to what ever', 'en-us - link' );
+ translated = App.i18n.translateContent('some link [to what ever](%s)', 'http://lalala')
+ equal(translated, 'some link to what ever', 'en-us - link')
- translated = App.i18n.translateContent('Enables user authentication via %s. Register your app first at [%s](%s).', 'XXX', 'YYY', 'http://lalala');
- equal( translated, 'Enables user authentication via XXX. Register your app first at YYY.', 'en-us - link' );
+ translated = App.i18n.translateContent('Enables user authentication via %s. Register your app first at [%s](%s).', 'XXX', 'YYY', 'http://lalala')
+ equal(translated, 'Enables user authentication via XXX. Register your app first at YYY.', 'en-us - link')
- timestamp = App.i18n.translateTimestamp('2012-11-06T21:07:24Z', offset);
- equal( timestamp, '11/06/2012 21:07', 'en - timestamp translated correctly' );
+ timestamp = App.i18n.translateTimestamp('2012-11-06T21:07:24Z', offset)
+ equal(timestamp, '11/06/2012 21:07', 'en - timestamp translated correctly')
// locale alias test
// de
- App.i18n.set('de');
- var translated = App.i18n.translateContent('yes');
- equal( translated, 'ja', 'de - yes / ja translated correctly' );
+ App.i18n.set('de')
+ var translated = App.i18n.translateContent('yes')
+ equal(translated, 'ja', 'de - yes / ja translated correctly')
// locale detection test
// de-ch
- App.i18n.set('de-ch');
- var translated = App.i18n.translateContent('yes');
- equal( translated, 'ja', 'de - yes / ja translated correctly' );
+ App.i18n.set('de-ch')
+ var translated = App.i18n.translateContent('yes')
+ equal(translated, 'ja', 'de - yes / ja translated correctly')
});
// events
-test( "events simple", function() {
+test('events simple', function() {
// single bind
- App.Event.bind( 'test1', function(data) {
- ok( true, 'event received - single bind');
- equal( data.success, true, 'event received - data ok - single bind');
+ App.Event.bind('test1', function(data) {
+ ok(true, 'event received - single bind')
+ equal(data.success, true, 'event received - data ok - single bind')
});
- App.Event.bind( 'test2', function(data) {
- ok( false, 'should not be triggered - single bind');
+ App.Event.bind('test2', function(data) {
+ ok(false, 'should not be triggered - single bind')
});
- App.Event.trigger( 'test1', { success: true } );
+ App.Event.trigger('test1', { success: true })
- App.Event.unbind( 'test1')
- App.Event.bind( 'test1', function(data) {
- ok( false, 'should not be triggered - single bind');
+ App.Event.unbind('test1')
+ App.Event.bind('test1', function(data) {
+ ok(false, 'should not be triggered - single bind')
});
- App.Event.unbind( 'test1');
- App.Event.trigger( 'test1', { success: true } );
+ App.Event.unbind('test1')
+ App.Event.trigger('test1', { success: true })
// multi bind
- App.Event.bind( 'test1-1 test1-2', function(data) {
- ok( true, 'event received - multi bind');
- equal( data.success, true, 'event received - data ok - multi bind');
+ App.Event.bind('test1-1 test1-2', function(data) {
+ ok(true, 'event received - multi bind')
+ equal(data.success, true, 'event received - data ok - multi bind')
});
- App.Event.bind( 'test1-3', function(data) {
- ok( false, 'should not be triggered - multi bind');
+ App.Event.bind('test1-3', function(data) {
+ ok(false, 'should not be triggered - multi bind')
});
- App.Event.trigger( 'test1-2', { success: true } );
+ App.Event.trigger('test1-2', { success: true })
- App.Event.unbind( 'test1-1')
- App.Event.bind( 'test1-1', function(data) {
- ok( false, 'should not be triggered - multi bind');
+ App.Event.unbind('test1-1')
+ App.Event.bind('test1-1', function(data) {
+ ok(false, 'should not be triggered - multi bind')
});
- App.Event.trigger( 'test1-2', { success: true } );
+ App.Event.trigger('test1-2', { success: true })
});
-test( "events level", function() {
+test('events level', function() {
// bind with level
- App.Event.bind( 'test3', function(data) {
- ok( false, 'should not be triggered!');
- }, 'test-level' );
+ App.Event.bind('test3', function(data) {
+ ok(false, 'should not be triggered!')
+ }, 'test-level')
// unbind with level
- App.Event.unbindLevel( 'test-level' );
+ App.Event.unbindLevel( 'test-level')
// bind with level
- App.Event.bind( 'test3', function(data) {
- ok( true, 'event received');
- equal( data.success, true, 'event received - data ok - level bind');
- }, 'test-level' );
- App.Event.trigger( 'test3', { success: true} );
+ App.Event.bind('test3', function(data) {
+ ok(true, 'event received')
+ equal(data.success, true, 'event received - data ok - level bind')
+ }, 'test-level')
+ App.Event.trigger('test3', { success: true})
});
// session store
-test( "session store", function() {
+test('session store', function() {
var tests = [
'some 123äöüßadajsdaiosjdiaoidj',
@@ -449,16 +449,16 @@ test( "session store", function() {
// write/get
App.SessionStorage.clear()
_.each(tests, function(test) {
- App.SessionStorage.set( 'test1', test );
- var item = App.SessionStorage.get( 'test1' );
- deepEqual( test, item, 'write/get - compare stored and actual data' )
+ App.SessionStorage.set('test1', test)
+ var item = App.SessionStorage.get('test1')
+ deepEqual(test, item, 'write/get - compare stored and actual data')
});
// undefined/get
App.SessionStorage.clear()
_.each(tests, function(test) {
- var item = App.SessionStorage.get( 'test1' );
- deepEqual( undefined, item, 'undefined/get - compare not existing data and actual data' )
+ var item = App.SessionStorage.get('test1')
+ deepEqual(undefined, item, 'undefined/get - compare not existing data and actual data')
});
// write/get/delete
@@ -470,21 +470,21 @@ test( "session store", function() {
App.SessionStorage.clear()
_.each(tests, function(test) {
- App.SessionStorage.set( test.key, test.value );
+ App.SessionStorage.set(test.key, test.value)
});
_.each(tests, function(test) {
- var item = App.SessionStorage.get( test.key );
- deepEqual( test.value, item, 'write/get/delete - compare stored and actual data' );
- App.SessionStorage.delete( test.key );
- item = App.SessionStorage.get( test.key );
- deepEqual( undefined, item, 'write/get/delete - compare deleted data' );
+ var item = App.SessionStorage.get(test.key)
+ deepEqual(test.value, item, 'write/get/delete - compare stored and actual data')
+ App.SessionStorage.delete( test.key)
+ item = App.SessionStorage.get(test.key)
+ deepEqual(undefined, item, 'write/get/delete - compare deleted data')
});
});
// config
-test( "config", function() {
+test('config', function() {
// simple
var tests = [
@@ -494,12 +494,12 @@ test( "config", function() {
];
_.each(tests, function(test) {
- App.Config.set( test.key, test.value )
+ App.Config.set(test.key, test.value )
});
_.each(tests, function(test) {
- var item = App.Config.get( test.key )
- deepEqual( item, test.value, 'set/get tests' );
+ var item = App.Config.get(test.key )
+ deepEqual(item, test.value, 'set/get tests')
});
// group
@@ -510,24 +510,24 @@ test( "config", function() {
];
var group = {};
_.each(test_groups, function(test) {
- App.Config.set( test.key, test.value, 'group1' );
+ App.Config.set(test.key, test.value, 'group1')
group[test.key] = test.value
});
// verify whole group
- var item = App.Config.get( 'group1' );
- deepEqual( item, group, 'group - verify group hash');
+ var item = App.Config.get('group1')
+ deepEqual(item, group, 'group - verify group hash')
// verify each setting
_.each(test_groups, function(test) {
- var item = App.Config.get( test.key, 'group1' );
- deepEqual( item, test.value, 'group set/get tests' );
+ var item = App.Config.get(test.key, 'group1')
+ deepEqual(item, test.value, 'group set/get tests')
});
});
// clone
-test( "clone", function() {
+test('clone', function() {
// simple
var tests = [
@@ -578,7 +578,7 @@ test( "clone", function() {
_.each(tests, function(test) {
var item = clone( test )
- deepEqual( item, test, 'clone' );
+ deepEqual(item, test, 'clone')
});
// complex test
@@ -597,8 +597,7 @@ test( "clone", function() {
// modify source later, should not have any result
source[0].name = 'some new name'
- deepEqual( result, reference, 'clone' );
-
+ deepEqual(result, reference, 'clone')
// full test
var source = [
@@ -617,97 +616,110 @@ test( "clone", function() {
source[0].name = 'some new name'
source[2].fn = 'some new name'
- deepEqual( result[0], reference[0], 'clone full' );
- deepEqual( result[1], reference[1], 'clone full' );
+ deepEqual(result[0], reference[0], 'clone full')
+ deepEqual(result[1], reference[1], 'clone full')
- equal( typeof reference[2].fn, 'function')
- equal( typeof result[2].fn, 'function')
+ equal(typeof reference[2].fn, 'function')
+ equal(typeof result[2].fn, 'function')
- equal( reference[2].fn(), 'test')
- equal( result[2].fn(), 'test')
+ equal(reference[2].fn(), 'test')
+ equal(result[2].fn(), 'test')
});
// diff
-test( "diff", function() {
+test('difference', function() {
// simple
- var tests = [
- {
- object1: {
- key1: 123,
- key2: 1234
- },
- object2: {
- key1: 123,
- key2: 1235
- },
- result: {
- key2: 1235
- }
- },
- {
- object1: {
- key1: 123,
- key2: 123
- },
- object2: {
- key1: 123,
- key2: 123
- },
- result: {}
- },
- {
- object1: {
- key1: 123,
- key2: 123
- },
- object2: {
- key1: 123,
- key2: 123
- },
- result: {}
- },
- {
- object1: {
- key1: 123,
- key2: [1,3,5]
- },
- object2: {
- key1: 123,
- key2: 123
- },
- result: {
- key2: 123
- }
- },
- {
- object1: {
- key1: 123,
- key2: [1,3,5]
- },
- object2: {
- key1: 123,
- },
- result: {}
- },
- {
- object1: {
- key1: 123,
- },
- object2: {
- key1: 123,
- key2: 124
- },
- result: {}
- },
- ];
+ var object1 = {
+ key1: 123,
+ key2: 1234
+ }
+ var object2 = {
+ key1: 123,
+ key2: 1235
+ }
+ var result = {
+ key2: 1235
+ }
+ var item = difference(object1, object2)
+ deepEqual(item, result)
- _.each(tests, function(test) {
- var item = difference( test.object1, test.object2 )
- deepEqual( item, test.result, 'tests simple' );
- });
+ object1 = {
+ key1: 123,
+ key2: 123
+ }
+ object2 = {
+ key1: 123,
+ key2: 123
+ }
+ result = {}
+ item = difference(object1, object2)
+ deepEqual(item, result)
+ object1 = {
+ key1: 123,
+ key2: [1,3,5]
+ }
+ object2 = {
+ key1: 123,
+ key2: 123
+ }
+ result = {
+ key2: 123
+ }
+ item = difference(object1, object2)
+ deepEqual(item, result)
+
+ object1 = {
+ key1: 123,
+ key2: [1,3,5]
+ }
+ object2 = {
+ key1: 123,
+ }
+ result = {}
+ item = difference(object1, object2)
+ deepEqual(item, result)
+
+ object1 = {
+ key1: 123,
+ }
+ object2 = {
+ key1: 123,
+ key2: 124
+ }
+ result = {}
+ item = difference(object1, object2)
+ deepEqual(item, result)
+
+ object1 = {
+ customer_id: 1,
+ organization_id: 2,
+ }
+ object2 = {
+ customer_id: 1,
+ organization_id: null,
+ }
+ result = {
+ organization_id: null,
+ }
+ item = difference(object1, object2)
+ deepEqual(item, result)
+
+ object1 = {
+ customer_id: 1,
+ organization_id: null,
+ }
+ object2 = {
+ customer_id: 1,
+ organization_id: 2,
+ }
+ result = {
+ organization_id: 2,
+ }
+ item = difference(object1, object2)
+ deepEqual(item, result)
});
@@ -718,14 +730,14 @@ App.Auth.login({
password: 'not_existing',
},
success: function(data) {
- test( "auth - not existing user", function() {
- ok( false, 'ok' )
+ test('auth - not existing user', function() {
+ ok(false, 'ok')
})
},
error: function() {
- test( "auth - not existing user", function() {
- ok( true, 'ok' )
- authWithSession();
+ test('auth - not existing user', function() {
+ ok(true, 'ok')
+ authWithSession()
})
}
});
@@ -737,15 +749,15 @@ var authWithSession = function() {
password: 'test',
},
success: function(data) {
- test( "auth - existing user", function() {
- ok( true, 'authenticated')
- var user = App.Session.get('login');
- equal( 'nicole.braun@zammad.org', user, 'session login' )
+ test('auth - existing user', function() {
+ ok(true, 'authenticated')
+ var user = App.Session.get('login')
+ equal('nicole.braun@zammad.org', user, 'session login')
})
},
error: function() {
- test( "auth - existing user", function() {
- ok( false, 'not authenticated' )
+ test('auth - existing user', function() {
+ ok(false, 'not authenticated')
})
}
});
diff --git a/test/browser/agent_ticket_attachment_test.rb b/test/browser/agent_ticket_attachment_test.rb
index cc888df1b..b91a4f6c2 100644
--- a/test/browser/agent_ticket_attachment_test.rb
+++ b/test/browser/agent_ticket_attachment_test.rb
@@ -40,7 +40,7 @@ class AgentTicketAttachmentTest < TestCase
# add attachment, attachment check should quiet
file_upload(
- css: '.active .attachmentPlaceholder-inputHolder input',
+ css: '.content.active .attachmentPlaceholder-inputHolder input',
files: ['test/fixtures/upload2.jpg', 'test/fixtures/upload1.txt'],
)
@@ -54,13 +54,13 @@ class AgentTicketAttachmentTest < TestCase
# check if ticket is shown and attachment exists
location_check(url: '#ticket/zoom/')
sleep 2
- ticket_number = @browser.find_elements({ css: '.active .ticketZoom-header .ticket-number' })[0].text
+ ticket_number = @browser.find_elements({ css: '.content.active .ticketZoom-header .ticket-number' })[0].text
match(
- css: '.active .ticket-article-item:nth-child(1) .attachments',
+ css: '.content.active .ticket-article-item:nth-child(1) .attachments',
value: 'upload2.jpg',
)
match(
- css: '.active .ticket-article-item:nth-child(1) .attachments',
+ css: '.content.active .ticket-article-item:nth-child(1) .attachments',
value: 'upload1.txt',
)
@@ -77,7 +77,7 @@ class AgentTicketAttachmentTest < TestCase
)
# submit form
- click(css: '.active .js-submit')
+ click(css: '.content.active .js-submit')
sleep 2
# check warning
@@ -86,12 +86,12 @@ class AgentTicketAttachmentTest < TestCase
# add attachment, attachment check should quiet
file_upload(
- css: '.active .attachmentPlaceholder-inputHolder input',
+ css: '.content.active .attachmentPlaceholder-inputHolder input',
files: ['test/fixtures/upload1.txt'],
)
# submit form
- click(css: '.active .js-submit')
+ click(css: '.content.active .js-submit')
sleep 2
# no warning
@@ -113,34 +113,34 @@ class AgentTicketAttachmentTest < TestCase
# check content and edit screen in instance 1
match(
- css: '.active div.ticket-article',
+ css: '.content.active div.ticket-article',
value: 'test 6 - ticket 1-1',
)
match_not(
- css: '.active .ticket-article-item:nth-child(3) .attachments',
+ css: '.content.active .ticket-article-item:nth-child(3) .attachments',
value: 'upload2.jpg',
)
match(
- css: '.active .ticket-article-item:nth-child(3) .attachments',
+ css: '.content.active .ticket-article-item:nth-child(3) .attachments',
value: 'upload1.txt',
)
# add attachment without body
file_upload(
- css: '.active .attachmentPlaceholder-inputHolder input',
+ css: '.content.active .attachmentPlaceholder-inputHolder input',
files: ['test/fixtures/upload2.jpg', 'test/fixtures/upload1.txt'],
)
# submit form
- click(css: '.active .js-submit')
+ click(css: '.content.active .js-submit')
sleep 2
# check warning
match(
- css: '.active .modal',
+ css: '.content.active .modal',
value: 'missing',
)
- click(css: '.active .modal .js-cancel')
+ click(css: '.content.active .modal .js-cancel')
sleep 2
ticket_update(
@@ -151,7 +151,7 @@ class AgentTicketAttachmentTest < TestCase
)
# submit form
- click(css: '.active .js-submit')
+ click(css: '.content.active .js-submit')
sleep 2
# discard changes should gone away
@@ -166,11 +166,11 @@ class AgentTicketAttachmentTest < TestCase
},
)
match(
- css: '.active .ticket-article-item:nth-child(4) .attachments',
+ css: '.content.active .ticket-article-item:nth-child(4) .attachments',
value: 'upload2.jpg',
)
match(
- css: '.active .ticket-article-item:nth-child(4) .attachments',
+ css: '.content.active .ticket-article-item:nth-child(4) .attachments',
value: 'upload1.txt',
)
#
@@ -216,10 +216,10 @@ class AgentTicketAttachmentTest < TestCase
)
# check if customer has changed in second browser
- click(browser: browser1, css: '.active .tabsSidebar-tab[data-tab="customer"]')
+ click(browser: browser1, css: '.content.active .tabsSidebar-tab[data-tab="customer"]')
watch_for(
browser: browser1,
- css: '.active .tabsSidebar',
+ css: '.content.active .tabsSidebar',
value: user_email,
)
@@ -228,17 +228,17 @@ class AgentTicketAttachmentTest < TestCase
#
# modify customer
- click(browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
- click(browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
+ click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
+ click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
sleep 2
set(browser: browser1, css: '.modal [name="address"]', value: 'some new address')
click(browser: browser1, css: '.modal .js-submit')
# verify is customer has chnaged other browser too
- click(browser: browser2, css: '.active .tabsSidebar-tab[data-tab="customer"]')
+ click(browser: browser2, css: '.content.active .tabsSidebar-tab[data-tab="customer"]')
watch_for(
browser: browser2,
- css: '.active .sidebar[data-tab="customer"]',
+ css: '.content.active .sidebar[data-tab="customer"]',
value: 'some new address',
)
@@ -247,8 +247,8 @@ class AgentTicketAttachmentTest < TestCase
#
# change org of customer, check if org is shown in sidebar
- click(browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
- click(browser: browser1, css: '.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
+ click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
+ click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
sleep 2
set(browser: browser1, css: '.modal .js-input', value: 'zammad')
click(browser: browser1, css: '.modal .js-input')
@@ -258,10 +258,10 @@ class AgentTicketAttachmentTest < TestCase
# check if org has changed in second browser
sleep 3
- click(browser: browser2, css: '.active .tabsSidebar-tab[data-tab="organization"]')
+ click(browser: browser2, css: '.content.active .tabsSidebar-tab[data-tab="organization"]')
watch_for(
browser: browser2,
- css: '.active .sidebar[data-tab="organization"]',
+ css: '.content.active .sidebar[data-tab="organization"]',
value: 'Zammad Foundation',
)