summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/tests
AgeCommit message (Collapse)Author
2019-08-06[FIX] web_editor: remove virtual corrector/completion keyboard glitchGorash
For the ours need, we can not let the contentEditable behavior. Indeed, this one does not have the same behavior according to the browser. The DOM node could be erase, merge, cut, in them according to the keyboard interactions. The problem is that if we have to manage these behaviors, we have to manage everything. It was already the case in the previous version, however before we created an editor by zone and by a hack we mix the history. In the case of the virtual keyboard of some OS / Phone, the events are different and the autocompletion does not update (bug that prevents modification interactions with javascript). In order to solve these problems, we use another event for the insertion of the characters. However, we must also force the update of the corrector by forcing a blur and a focus. The current version is a temporary version. We are currently working on a version that uses a virtual dom and does not need to do excessive prevent default.
2019-07-19[FIX] web_editor: momentarily comment the assertRomainLibert
Having an assert that randomly breaks is quite annoying, as this assert is not critical and breaks once every 100 - 120 builds. It can "safely" be commented out before being fixed closes odoo/odoo#35043 Signed-off-by: Romain Libert (rli) <rli@odoo.com>
2019-07-16[MERGE] Forward port of saas-12.2 to saas-12.3 up to cf8e74a1a7d34Martin Trigaux
closes odoo/odoo#34907 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-11[FIX] web_editor: properly insert character in empty nested listAntoine Guenet
Fix a bug that can be reproduced like so: - Insert list - Type char - ENTER - TAB - Type char The character gets inserted _after_ the `br` instead of replacing it. closes odoo/odoo#34805 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-06-03[MERGE] forward port branch saas-12.2 up to 995aa1685eeChristophe Simonis
2019-05-06[MERGE] forward port branch saas-12.2 up to 78b3b650b0dChristophe Simonis
2019-04-19[FIX] web_editor: disable tooltips in keyboard tests and on option offAntoine Guenet
The link and media tooltips were not taking Summernote's `tooltip` option into account. That option ensures that tooltips are disabled if the option is off (which is for instance the case on mobile). This fix ensures that these tooltips are disabled when the option is set to `false`. It also disables tooltips in the keyboard tests. They are not relevant to the keyboard tests and occasionally caused the DOM to not be properly cleaned after the tests were run (most likely due to their 2000ms `setTimeout`).
2019-05-13[FIX] web_editor: indent multiple lines at a time with editable as parentGorash
2019-04-30[FIX] web_editor: properly unformat text at the start of the DOMAntoine Guenet
When trying to remove a format (bold, italic, underline), collapsed at the start of the DOM, an error occurred because of a wrong range. Ex.: `<p><b>Odoo</b></p>` -> when clicking before the word "Odoo", then clicking the "bold" button, we expect to be able to start writing in plain (not bold) text (for that, the DOM has to look like this: `<p>\u200B<b>Odoo</b></p>`). We now have that proper behavior without the accompanying error message and loss of selection. Task ID: 1978515 closes odoo/odoo#33038 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-04-25[FIX] web_editor, website: never indent/outdent list groupsAntoine Guenet
The "comparisons" website snippet uses a list group with the class set on a UL. In consequence, the web editor considers it as a regular list and may try to outdent it, which is not the expected behavior with a list group. This fix ensures that ULs with the `list-group` class cannot be in/outdented. closes odoo/odoo#32709 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-04-25[FIX] web_editor: properly merge a LI with text with a LI with text in PAntoine Guenet
A list item with text can be written as <li>text</li> or as <li><p>text</p></li>. Issues occurred when both syntaxes need to be merged together. Namely, the <p>text</p> was being appended to the other list item, thereby creating a visible new line.
2019-04-25[FIX] web_editor: properly handle delete in nested lists of all syntaxesAntoine Guenet
This addresses various bugs that occured with nested lists - including lists that are nested with a UL within a LI (as opposed to a UL directly within another UL).
2019-04-25[FIX] web_editor: properly convert a checklist to an ordered listAntoine Guenet
The `o_checklist` class was preserved when converting a checklist to an ordered list.
2019-04-15[FIX] web_editor: uncheck new checklist item on splitAntoine Guenet
On ENTER in a checklist item, a new checklist item is created. The new one should never be checked. This ensures that ENTER in a checked checklist item never creates a checked checklist item but instead cleans the class. closes odoo/odoo#32684 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2019-03-05[FIX]web_editor: Fixed traceback due to 'field_html' widget while saving recordmgh-odoo
Previously, when user edited record having 'field_html' widget and tried to save the record immediately, a traceback was faced sometimes because content was not loaded yet. This commit fixes the issue by calling super method if the content is not loaded yet properly. Task: #1932687 Closes: #30833 closes odoo/odoo#31581 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-02-21[IMP] web_editor: add tests for deleting all contents of format blockAntoine Guenet
Implementing new behavior on delete all contents of a format block revealed insufficient testing, which is now covered. closes odoo/odoo#31277
2019-02-21[FIX] web_editor: remove broken and unnecessary testAntoine Guenet
The next test was identical to the removed one, with the exception that it inserts a character at the end, which really is the behavior we want to test. The removed test was broken because it expected the range on the parent, which is anyway equivalent in this case. This is confirmed by the fact that inserting a character at either ranges indeed inserts the character where it is expected to do so.
2019-03-22[FIX] *: pass context in kwargs in rpc callsRaphael Collet
2019-03-13[MERGE] forward port branch saas-12.2 up to c9f832d9f03Christophe Simonis
closes odoo/odoo#31790 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-08[FIX] web_editor: fix non-deterministic testsDavid Monjoie
Those tests were skipped because they were failing non-deterministically. This commit aims to make them deterministic by putting back some guard promises that were lost during the jquery update adaptation. This commit also fixes a lingering issue with one of the asserts. We observed that sometimes, the "alt" and "title" attributes where both present on the element but displayed in different order in the string returned by wysiwyg.getValue(). This is because there is no set order in the attribute returned by jQuery.html(). Because of that, I replaced the simple sring test by a thorough manual comparison of the result that is expected to be equivalent. closes odoo/odoo#31671 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-03-06[FIX] web_editor: temporarily skip two testsVincent Schippefilt
Those two tests non deterministically fail on the jQuery branch. We'll fix them after the merge.
2019-03-06[REF] web_editor: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-14[IMP] web_editor: lazy load the wysiwygChristophe Matthieu
Issue: wysiwyg asset slow down the loading of the website, error inadvertently introduced: https://github.com/odoo/odoo/pull/29775 The assets are now loaded assynchroneously, when the editor is needed, its assets will be loaded. closes odoo/odoo#30700
2019-02-07[FIX] web_editor: on anchor split, rerange and clean data on getValueAntoine Guenet
Due to a wrong order of operations, after splitting an anchor (press ENTER), the range was setting on the first anchor. Now it sets on the second one (as the code - but not the tests - suggests was supposed to happen). Tests were adapted to reflect that change. In tests, after splitting the anchor, `Wysiwyg.getValue` didn't always properly clean up `data-original-title`. Targetting empty `data-original-title` attribute instead of `aria-describedby` attribute should fix that issue. closes odoo/odoo#30923
2019-02-04[IMP] web_editor: handle CTRL+A (and then DELETE) locallyAntoine Guenet
This fixes issues with CTRL+A then delete. Now CTRL+A selects all the contents of the unbreakable node in which the range is contained. Deleting it all will replace the contents with `<p><br></p>` so the user can start editing afresh. Note: Only CTRL+A is handled: ``select all`` in contextual and edit menus are still handled by the browser. closes odoo/odoo#30648
2019-01-29[FIX] web_editor: properly disable the toolbar on snippet removalAntoine Guenet
Update editor toolbar on each change to properly disable it when needed closes odoo/odoo#30594
2019-01-17[ADD] web_editor,*: Tests for new structure of web editorAntoine Guenet
The refactoring also had to be done in order to create a set of unit tests. Each behavior can be tested, including the behaviors performed as a consequence of keyboard interactions (for instance: Enter, Tab...). This commit also contains some changes to test_utils that were necessary given the new structure of the wysiwyg editor. Co-authored-by: Gorash <chm@odoo.com>
2019-01-17[REF] web_editor,*: Move and rename files to prepare refactoringChristophe Matthieu
The refactoring of the wysiwyg editor and 'html' field allows us to move some of the code that was in web_editor but only used in website or in mass_mailing. Some parts are still in web_editor but will be moved at a later time.
2018-12-07[REF] web: move ControlPanel inside controllers/actionsGéry Debongnie
This branch introduces a large-scale reorganization of the component tree generated by the web client. The short version is that now, the control panel is a child of the view controller and no longer a sibling. Graphically (and simplified), we go from this: webClient / | \ ... ... actionManager / \ controlPanel viewController / \ to this: webClient / | \ ... ... actionManager | viewController / | \ ControlPanelController / \ CPRenderer CPModel The motivation is that this work moves the code where it should be. Before this commit, it was kind of weird to have code in the controllers to render buttons outside of their root node (in renderButtons). Also, the action manager had to take care of coordinating search view states between view transitions. So, this work simplifies the code. It also makes it easier to extend. We see day after day that Odoo needs to take care of more complex UI needs, and in many cases, these needs were quite difficult to implement (we prefer spaghettis in our plates, not in our code). The changes in this branch should open the way to implement these features. For example, - it will now be easy to add the possibility of views (for example, the search view or a new ControlPanel view) to add custom buttons (of type action or object) in the control panel. - Another need will be to serialize/ restore the state of the search view across action boundaries (needed by the dashboard). - Another example is the possibility for views to customize easily the presence/absence of sub menus (filters/groupbys/favorites/ time range/...) - Another need is an easier way for views/client action to customize their control panel. This commit also contains a large rewrite of the search view (so it is more inline with our architecture and easier to maintain). Part of task 1893568 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
2018-11-19[REF] *: update js test suite to use helpersGéry Debongnie
This rev. introduces robust helpers to use in the JS tests suite to interact with DOM and components, and starts using them (almost) everywhere. All the helpers are exposed though testUtils.js. There are 2 kinds of helpers: 1. Assertions ------------- * assert.containsNone, containsN, containsOnce check that the DOM (or a specific part of the DOM) contains a `selector`. It generates a correct error message automatically. ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg"); -> assert.containsOnce(form, '.o_form_editable'); * assert.isVisible, isNotVisible check that the DOM has an element visible or not. They also check that the element is actually in the DOM (before most tests didn't verify this). * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific properties of a DOM element, and also validate that it is applied on a single existing DOM element (before most tests didn't verify this). ex: assert.notOk(form.$('button').hasClass('btn-primary')); -> assert.doesNotHaveClass(form.$('button'), 'btn-primary'); 2. Utilities ------------ The goal of the utilities is to centralize the definition of many standard components and interactions, ensuring that when we refactor the JS framework, we do not need to change all the tests. Existing mock utilities (addMockEnvironment, intercept, path, patchDate, unpatch and fieldsViewGet) are moved to 'testUtils.mock.*'. Existing DOM utilities are moved to 'testUtils.dom.*'. New dom utilities are created for opendDatePicker, click, clickFirst and clickLast. Helper `click` verifies that there is exactly 1 element visible in the DOM you click on, `clickFirst` and `clickLast` verify that there are more than one element on the DOM. ex: form.$('button').click(); -> testUtils.dom.click(form.$('button')); New Form utilities: (testUtils.form.*) clickEdit, clickSave, clickCreate, clickDiscard, all clicks on the control panel buttons of the form. `reload` reloads the form data. New modal, graph, kanban and pivot utils (testUtils.pivot.*, testUtils.kanban.*, etc.). New fields utils: (testUtils.fields.*) * editInput, editSelect: allow to change the value of a field, using a selector to identify it. They validate that the input exists and trigger the change event automatically. * editAndTrigger: allow to modify a field and trigger specific events after the value change * many2one (testUtils.fields.many2one.*) clickOpenDropdown, clickHighlightedItem, clickItem, searchAndClickItem: use a field name instead of a selector and do all the complex mechanism to open, filter and highlight many2one fields. Joint work with aab, dam, ged, mge, svs and vsc.
2018-02-01[FIX] web_editor: avoid useless 404 during testJeremy Kersten
removeSrcAttribute should avoid these rpc, but for some unknown reasons, on firefox it works but not with chrome. Because the purpose of the test is to check the url and not the content, that works to use an existing route. Courtesy of @kangol for the fix
2017-12-18[FIX] web_editor: html field commitchanges fully loadedAlexandre Kühn
Fix over this one: https://github.com/odoo/odoo/commit/cae188514fa8b0a7c785a630ac4aff677b2071fa The intent was to disable buttons in form views until html fields are fully loaded, but it was not disabling the buttons for the following reasons: 1. It is looking for buttons in the DOM, although they are not already attached into the body at this moment. 2. It was disabling the buttons only at widget start(), so only once after "Empty Cache and Hard Reload". We propose a better solution than disabling the buttons in the control panel: when we click on "Save", the html field ensures that it is fully loaded while commiting the changes.
2017-08-10[FIX] web_editor: html_frame: saving in readonlyAaron Bohy
A form view record may be saved even if the record is displayed in readonly (e.g. when a button in the form view is clicked). When this happened, if there were an html field with html_frame widget in the form, it crashed (e.g. in Email Marketing > Mass Mailings > open one > click on Test Mailing).
2017-06-28[FIX] web_editor: make html widget translatableDarshan Kalola
The translate feature of widgets html and html_frame had been broken by the new views refactoring. This commit restores it for the html widget, and removes it completely for html_frame as it wasn't working correctly before the new views anyway (moreover, it had already been disabled for mass_mailing: de403dc1ab440b9b08ea7fce189cd157745dfe74). This commit also ensures that the changes are correctly saved for the html_frame widget. Note that this widget still needs to be converted to our new coding guidelines.
2017-05-29[FIX] web_editor: prevent crash with FieldTextHtmlSimpleGéry Debongnie
If the method commitChange from the widget FieldTextHtmlSimple was called in mode=readonly, a traceback was displayed. This is not very common, because most save operations are done in mode=edit, but it can happen in readonly mode: when the user clicks on an action button, then the form view is saved, if necessary. To reproduce this bug, just open a form view for res.users, and click on the Change Password button.
2017-04-13[FIX] web(_editor): field widget htmlAaron Bohy
The field widget html wasn't implemented yet in the new views. A very basic implementation was done in addon web. It only handled the readonly mode so that the field were displayed in studio. This commit removes this basic implementation from web, and re- introduced the old one, converted, in addon web_editor.
2017-04-11[FIX] web_editor: various fixes and new testsAaron Bohy
- use 'nodeOptions' instead of 'options' in FieldTextHTML as 'options' doesn't exist, it has been renamed into nodeOptions in AbstractField. - mock iframe route in test to prevent the test framework from displaying an error (unimplemented route), and so the test from being red. - test that the url given in the node options is correctly used. - remove useless and broken code introduced by last rebase.
2017-04-11[REF] web, *: redesign all JS viewsGéry Debongnie
This commit introduce a full redesign of all JS views. We started basically from scratch. The goal was to unify all the various views under a common framework, to make them testable, to make then usable in different conditions (in studio, or in the frontend), and to make our lives easier. Some important points are: - we introduced new coding guidelines (camelCase, 80 chars width, ...) - we have a brand new testing framework (still QUnit based) - kanban view moved to the web addon - calendar view (formerly web_calender) moved to web as well - the tree view was removed - all new code should be documented We hope that this code is the start of a new era for the Odoo web client, we want to have a high quality codebase, well documented, well tested, well designed. Work done by the framework team: mostly aab, ged, chm, dmo, qsm