summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorAnkit Sathvara <asa@odoo.com>2017-11-07 15:31:14 +0530
committerAaron Bohy <aab@odoo.com>2018-03-02 15:45:42 +0100
commit6be9fa39674786dd75bb74cdbc6c8c6b4d3eccbb (patch)
treecce8552c8f727a0bc8f23ef698527fc86d49614c /addons/web/static/tests/fields/basic_fields_tests.js
parent0ecfd7bf3e6f2751833ef7435f66dba0f564f5ad (diff)
[IMP] web,hr: Phone widget is always clickable
With this commit, when a phone number is clicked (in readonly), - if voip is not installed, it opens an app according to the user choice (e.g. skype), and on mobile, it opens the phone app to call the number - if voip is installed, in desktop, it opens voip, and on mobile, it still opens the phone app to call the number, because webRTC is not supported. This commit also makes the employee form view use the phone widget for the 'Work Phone' and 'Work Mobile' fields. Task #30369
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js52
1 files changed, 18 insertions, 34 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 9f2e30d8529..11f39bc8147 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -3061,8 +3061,8 @@ QUnit.module('basic_fields', {
var $phoneLink = form.$('a.o_form_uri.o_field_widget');
assert.strictEqual($phoneLink.length, 1,
"should have a anchor with correct classes");
- assert.strictEqual($phoneLink.text(), 'y\u00ADop',
- "value should be displayed properly as text with the skype obfuscation");
+ assert.strictEqual($phoneLink.text(), 'yop',
+ "value should be displayed properly");
assert.strictEqual($phoneLink.attr('href'), 'tel:yop',
"should have proper tel prefix");
@@ -3079,8 +3079,8 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
$phoneLink = form.$('a.o_form_uri.o_field_widget');
- assert.strictEqual($phoneLink.text(), 'n\u00ADew',
- "new value should be displayed properly as text with the skype obfuscation");
+ assert.strictEqual($phoneLink.text(), 'new',
+ "new value should be displayed properly");
assert.strictEqual($phoneLink.attr('href'), 'tel:new',
"should still have proper tel prefix");
@@ -3104,8 +3104,8 @@ QUnit.module('basic_fields', {
assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').length, 5,
"should have 5 cells");
- assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').first().text(), 'y\u00ADop',
- "value should be displayed properly as text with the skype obfuscation");
+ assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').first().text(), 'yop',
+ "value should be displayed properly");
var $phoneLink = list.$('a.o_form_uri.o_field_widget');
assert.strictEqual($phoneLink.length, 5,
@@ -3125,7 +3125,7 @@ QUnit.module('basic_fields', {
list.$buttons.find('.o_list_button_save').click();
$cell = list.$('tbody td:not(.o_list_record_selector)').first();
assert.ok(!$cell.parent().hasClass('o_selected_row'), 'should not be in edit mode anymore');
- assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').first().text(), 'n\u00ADew',
+ assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').first().text(), 'new',
"value should be properly updated");
$phoneLink = list.$('a.o_form_uri.o_field_widget');
assert.strictEqual($phoneLink.length, 5,
@@ -3137,14 +3137,6 @@ QUnit.module('basic_fields', {
});
QUnit.test('phone field in form view on normal screens', function (assert) {
- // The behavior of this widget is completely altered by voip so this
- // test is irrelevant and fails if voip is installed. The enterprise
- // module is responsible for testing its own behavior in its own tests.
- if ('voip.user_agent' in odoo.__DEBUG__.services) {
- assert.expect(0);
- return;
- }
-
assert.expect(5);
var form = createView({
@@ -3166,11 +3158,11 @@ QUnit.module('basic_fields', {
},
});
- var $phone = form.$('span.o_field_widget:not(.o_form_uri)');
+ var $phone = form.$('a.o_field_widget.o_form_uri');
assert.strictEqual($phone.length, 1,
- "should have a simple span rather than a link");
+ "should have rendered the phone number as a link with correct classes");
assert.strictEqual($phone.text(), 'yop',
- "value should be displayed properly as text without skype obfuscation");
+ "value should be displayed properly");
// switch to edit mode and check the result
form.$buttons.find('.o_form_button_edit').click();
@@ -3184,21 +3176,13 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('span.o_field_widget:not(.o_form_uri)').text(), 'new',
- "new value should be displayed properly as text without skype obfuscation");
+ assert.strictEqual(form.$('a.o_field_widget.o_form_uri').text(), 'new',
+ "new value should be displayed properly");
form.destroy();
});
QUnit.test('phone field in editable list view on normal screens', function (assert) {
- // The behavior of this widget is completely altered by voip so this
- // test is irrelevant and fails if voip is installed. The enterprise
- // module is responsible for testing its own behavior in its own tests.
- if ('voip.user_agent' in odoo.__DEBUG__.services) {
- assert.expect(0);
- return;
- }
-
assert.expect(8);
var list = createView({
@@ -3216,10 +3200,10 @@ QUnit.module('basic_fields', {
assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').length, 5,
"should have 5 cells");
assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').first().text(), 'yop',
- "value should be displayed properly as text without skype obfuscation");
+ "value should be displayed properly");
- assert.strictEqual(list.$('span.o_field_widget:not(.o_form_uri)').length, 5,
- "should have spans with correct classes");
+ assert.strictEqual(list.$('a.o_field_widget.o_form_uri').length, 5,
+ "should have the correct classnames");
// Edit a line and check the result
var $cell = list.$('tbody td:not(.o_list_record_selector)').first();
@@ -3235,8 +3219,8 @@ QUnit.module('basic_fields', {
assert.ok(!$cell.parent().hasClass('o_selected_row'), 'should not be in edit mode anymore');
assert.strictEqual(list.$('tbody td:not(.o_list_record_selector)').first().text(), 'new',
"value should be properly updated");
- assert.strictEqual(list.$('span.o_field_widget:not(.o_form_uri)').length, 5,
- "should still have spans with correct classes");
+ assert.strictEqual(list.$('a.o_field_widget.o_form_uri').length, 5,
+ "should still have links with correct classes");
list.destroy();
});
@@ -3271,7 +3255,7 @@ QUnit.module('basic_fields', {
// save
form.$buttons.find('.o_form_button_save').click();
- assert.strictEqual(form.$('.o_field_widget').text().split('\u00AD').join(''), val,
+ assert.strictEqual(form.$('.o_field_widget').text(), val,
"value should have been correctly escaped");
form.destroy();