diff options
| author | Benjamin Vray <bvr@odoo.com> | 2020-03-13 12:59:25 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-07-17 11:28:11 +0000 |
| commit | a2fd2dacd977fb137c1aea7b5f9ee689f77ab05d (patch) | |
| tree | ddbe5277eba78dc7c0b319764551a4826a1c0572 | |
| parent | 316ceaf4d8e27d7e4ea4e95365a16800fa4884d1 (diff) | |
[IMP] website: review carousel snippet
Add the width option for each slides in the carousel snippet.
Remove share links from the third slide of the carousel.
Part of https://github.com/odoo/odoo/pull/45096
task-2162952
| -rw-r--r-- | addons/website/static/tests/tours/snippet_version.js | 28 | ||||
| -rw-r--r-- | addons/website/tests/test_ui.py | 21 | ||||
| -rw-r--r-- | addons/website/views/snippets/s_carousel.xml | 4 | ||||
| -rw-r--r-- | addons/website/views/snippets/snippets.xml | 2 |
4 files changed, 33 insertions, 22 deletions
diff --git a/addons/website/static/tests/tours/snippet_version.js b/addons/website/static/tests/tours/snippet_version.js index 7bbf3e7b0cb..d6a1d3e1e24 100644 --- a/addons/website/static/tests/tours/snippet_version.js +++ b/addons/website/static/tests/tours/snippet_version.js @@ -10,11 +10,11 @@ tour.register("snippet_version", { content: "Enter edit mode", trigger: 'a[data-action=edit]', }, { - content: "Drop s_carousel snippet", - trigger: '#oe_snippets .oe_snippet:has(.s_carousel) .oe_snippet_thumbnail', + content: "Drop s_test_snip snippet", + trigger: '#oe_snippets .oe_snippet:has(.s_test_snip) .oe_snippet_thumbnail', run: "drag_and_drop #wrap", }, { - content: "Drop s_carousel snippet", + content: "Drop s_text_image snippet", trigger: '#oe_snippets .oe_snippet:has(.s_text_image) .oe_snippet_thumbnail', run: "drag_and_drop #wrap", }, { @@ -26,12 +26,11 @@ tour.register("snippet_version", { if (![...draggableSnippets].every(el => el.dataset.snippet)) { console.error("error Some t-snippet are missing their template name"); } - // Currently only s_share is t-snippet-call, if it's removed find a way to keep t-snippet-call tested !!. - if (!document.querySelector('#oe_snippets [data-snippet="s_carousel"] [data-snippet="s_share"]')) { - console.error("error s_share t-called inside s_carousel is missing template name"); + if (!document.querySelector('#oe_snippets [data-snippet="s_test_snip"] [data-snippet="s_share"]')) { + console.error("error s_share t-called inside s_test_snip is missing template name"); } - if (!document.querySelector('#wrap [data-snippet="s_carousel"] [data-snippet="s_share"]')) { - console.error("error Dropped a s_carousel snippet but missing s_share template name in it"); + if (!document.querySelector('#wrap [data-snippet="s_test_snip"] [data-snippet="s_share"]')) { + console.error("error Dropped a s_test_snip snippet but missing s_share template name in it"); } }, }, { @@ -45,23 +44,20 @@ tour.register("snippet_version", { content: "Modify the version of snippets", trigger: '#oe_snippets .o_panel_body > .oe_snippet', run: function () { - document.querySelector('#oe_snippets .oe_snippet > [data-snippet="s_carousel"]').dataset.vjs = '999'; + document.querySelector('#oe_snippets .oe_snippet > [data-snippet="s_test_snip"]').dataset.vjs = '999'; document.querySelector('#oe_snippets .oe_snippet > [data-snippet="s_share"]').dataset.vcss = '999'; document.querySelector('#oe_snippets .oe_snippet > [data-snippet="s_text_image"]').dataset.vxml = '999'; }, }, { - content: "Edit carousel", - trigger: '#wrap.o_editable .s_carousel', + content: "Edit s_test_snip", + trigger: '#wrap.o_editable .s_test_snip', }, { content: "Edit text_image", - extra_trigger: 'we-customizeblock-options:contains(Carousel) .snippet-option-VersionControl > we-alert', + extra_trigger: 'we-customizeblock-options:contains(Test snip) .snippet-option-VersionControl > we-alert', trigger: '#wrap.o_editable .s_text_image', }, { - content: "Got to s_share slide", - extra_trigger: 'we-customizeblock-options:contains(Text - Image) .snippet-option-VersionControl > we-alert', - trigger: '#wrap.o_editable .s_carousel .carousel-control-prev', -}, { content: "Edit s_share", + extra_trigger: 'we-customizeblock-options:contains(Text - Image) .snippet-option-VersionControl > we-alert', trigger: '#wrap.o_editable .s_share', }, { content: "s_share is outdated", diff --git a/addons/website/tests/test_ui.py b/addons/website/tests/test_ui.py index ec538bf7903..8ea2bcd9fcc 100644 --- a/addons/website/tests/test_ui.py +++ b/addons/website/tests/test_ui.py @@ -62,7 +62,7 @@ class TestUiHtmlEditor(odoo.tests.HttpCase): Website = self.env['website'] View = self.env['ir.ui.view'] Page = self.env['website.page'] - + self.generic_view = View.create({ 'name': 'Generic', 'type': 'qweb', @@ -169,4 +169,23 @@ class TestUi(odoo.tests.HttpCase): self.start_tour("/", "public_user_editor", login=None) def test_07_snippet_version(self): + website_snippets = self.env.ref('website.snippets') + self.env['ir.ui.view'].create([{ + 'name': 'Test snip', + 'type': 'qweb', + 'key': 'website.s_test_snip', + 'arch': """ + <section class="s_test_snip"> + <t t-snippet-call="website.s_share"/> + </section> + """, + }, { + 'type': 'qweb', + 'inherit_id': website_snippets.id, + 'arch': """ + <xpath expr="//t[@t-snippet='website.s_parallax']" position="after"> + <t t-snippet="website.s_test_snip" t-thumbnail="/website/static/src/img/snippets_thumbs/s_website_form.png"/> + </xpath> + """, + }]) self.start_tour("/", 'snippet_version', login='admin') diff --git a/addons/website/views/snippets/s_carousel.xml b/addons/website/views/snippets/s_carousel.xml index a88f69c08bc..cf4bdbe39e5 100644 --- a/addons/website/views/snippets/s_carousel.xml +++ b/addons/website/views/snippets/s_carousel.xml @@ -50,10 +50,6 @@ <h4><font style="background-color: rgb(255, 255, 255);">Good writing is simple, but not simplistic.</font></h4> <p><br/></p> <p>Good copy starts with understanding how your product or service helps your customers. Simple words communicate better than big words and pompous language.</p> - <t t-snippet-call="website.s_share"> - <t t-set="_classes" t-value="'text-left pt16 pb16'"/> - <t t-set="_no_title" t-value="True"/> - </t> </div> </div> </div> diff --git a/addons/website/views/snippets/snippets.xml b/addons/website/views/snippets/snippets.xml index 33a9c2b7a77..74676248655 100644 --- a/addons/website/views/snippets/snippets.xml +++ b/addons/website/views/snippets/snippets.xml @@ -634,7 +634,7 @@ </div> <!-- Stretch section --> - <div data-js="ContainerWidth" data-selector="section" + <div data-js="ContainerWidth" data-selector="section, .s_carousel .carousel-item, s_quotes_carousel .carousel-item" data-target="> .container, > .container-fluid, > .o_container_small"> <we-button-group string="Content Width"> <we-button data-select-class="container-fluid" |
