[FIX] mail: tests: remove phantomjs hack with discuss

Revision on https://github.com/odoo/odoo/commit/e0a51edd856b36bfdf1cacb4d7e8d70fad7884fa

In the commit above, we added an option to Discuss widget
to render threads specifically for PhantomJS. The reason
for this is that a test was failing, because it needs full
support of CSS flexbox to pass.

However, PhantomJS does not support flexbox very well. As
a result, it was messing with the rendering of threads.
We couldn't make the hack just in the test itself, because
it is already at the moment of rendering the thread that
PhantomJS messes the whole process of the test.

PhantomJS has been replaced with Chrome headless [1], So
the hack is no longer be necessary, as Chrome headless
fully supports CSS flexbox.

[1] https://github.com/odoo/odoo/commit/de84ad9c1f4853cb8a748ee1d0c880081dae9fe2
This commit is contained in:
Alexandre Kühn
2018-08-16 22:26:50 +02:00
parent dd00a3d9f9
commit c995aa2cfd
4 changed files with 5 additions and 24 deletions
-8
View File
@@ -196,10 +196,6 @@ var Discuss = AbstractAction.extend(ControlPanelMixin, {
/**
* @override
* @param {Object} [options]
* @param {boolean} [options.phantomjs=false] if set, rendering of non-empty
* thread will use 'block' display instead of 'flex', because phantomjs
* sucks with flexbox... TODO: remove this option when we no longer use
* phantomJS
*/
init: function (parent, action, options) {
this._super.apply(this, arguments);
@@ -223,9 +219,6 @@ var Discuss = AbstractAction.extend(ControlPanelMixin, {
this._selectedMessage = null;
this._throttledUpdateThreads = _.throttle(
this._updateThreads.bind(this), 100, { leading: false });
// TODO: remove this option when we no longer use phantomJS
this._withPhantomJS = this.options.phantomjs || false;
},
/**
* @override
@@ -459,7 +452,6 @@ var Discuss = AbstractAction.extend(ControlPanelMixin, {
displayEmailIcons: false,
displayReplyIcons: true,
displayBottomThreadFreeSpace: true,
withPhantomJS: this._withPhantomJS, // TODO: remove this option when we no longer use phantomJS
};
},
/**
+2 -8
View File
@@ -156,9 +156,6 @@
@param {boolean} [options.displayLoadMore=false]
@param {string|integer} [options.messagesSeparatorPosition] 'top' or
message ID, the separator is placed just after this message.
@param {boolean} [options.withPhantomJS=false] phantomJS is a mess with flexbox
so it may break some features like auto-fetch message on scroll.
TODO: remove this option when we no longer use phantomJS
_____________
| |
@@ -172,7 +169,7 @@
-->
<t t-name="mail.widget.Thread.Content.ASC">
<div t-att-class="options.withPhantomJS ? '' : 'o_mail_thread_content_asc'">
<div class="o_mail_thread_content_asc">
<t t-if="options.messagesSeparatorPosition == 'top'" t-call="mail.MessagesSeparator"/>
<t t-set="messages" t-value="messages.slice().reverse()"/>
<t t-if="thread.hasTypingNotification()" t-call="mail.widget.Thread.TypingNotificationBar"/>
@@ -186,9 +183,6 @@
@param {Object} options
@param {boolean} [options.displayBottomThreadFreeSpace=false]
@param {boolean} [options.displayLoadMore=false]
@param {boolean} [options.withPhantomJS=false] phantomJS is a mess with flexbox
so it may break some features like auto-fetch message on scroll.
TODO: remove this option when we no longer use phantomJS
_____________
| |
@@ -201,7 +195,7 @@
DESC Order
-->
<t t-name="mail.widget.Thread.Content.DESC">
<div t-att-class="options.withPhantomJS ? '' : 'o_mail_thread_content_desc'">
<div class="o_mail_thread_content_desc">
<t t-if="options.displayLoadMore" t-call="mail.widget.Thread.LoadMore"/>
<t t-call="mail.widget.Thread.Messages"/>
<t t-if="options.displayBottomThreadFreeSpace">
+1 -2
View File
@@ -412,8 +412,7 @@ QUnit.test('older messages are loaded on scroll', function (assert) {
}
return this._super.apply(this, arguments);
},
}, { phantomjs: true }) // TODO: remove this option when we no longer use phantomJS
.then(function (discuss) {
}).then(function (discuss) {
assert.verifySteps(['message_fetch'],
"should fetch messages once for needaction messages (Inbox)");
@@ -25,13 +25,9 @@ var Widget = require('web.Widget');
* This is async due to mail_manager/mail_service that needs to be ready.
*
* @param {Object} params
* @param {Object} options
* @param {boolean} options.phantomjs if set, rendering of non-empty thread will
* use 'block' display instead of 'flex', because phantomjs sucks with flexbox
* TODO: remove this option when we no longer use phantomJS
* @return {$.Promise} resolved with the discuss widget
*/
function createDiscuss(params, options) {
function createDiscuss(params) {
var Parent = Widget.extend({
do_push_state: function () {},
});
@@ -41,7 +37,7 @@ function createDiscuss(params, options) {
'mail.message,false,search': '<search/>',
},
}));
var discuss = new Discuss(parent, params, options);
var discuss = new Discuss(parent, params);
discuss.set_cp_bus(new Widget());
var selector = params.debug ? 'body' : '#qunit-fixture';
var controlPanel = new ControlPanel(parent);