Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config with default template 5d22fbf8 #166

Merged
merged 7 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ parts/
pyvenv.cfg
var/
local.cfg
.python-version

# mxdev
/instance/
Expand All @@ -47,8 +46,6 @@ local.cfg
/venv/
.installed.txt

robot_*
test_*
forest.*

##
Expand Down
4 changes: 1 addition & 3 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See the inline comments on how to expand/tweak this configuration file
[meta]
template = "default"
commit-id = "721299ce"
commit-id = "5d22fbf8"

[pyproject]
codespell_skip = "*.js,*.min.js,*.min.js.map,*.min.css.map,*.svg,*.lock,*.json"
Expand All @@ -17,7 +17,5 @@ jobs = [

[gitignore]
extra_lines = """
robot_*
test_*
forest.*
"""
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ci:

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.2
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
Expand All @@ -16,7 +16,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/collective/zpretty
Expand All @@ -32,7 +32,7 @@ repos:
# """
##
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8

Expand All @@ -44,7 +44,7 @@ repos:
# """
##
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
Expand All @@ -71,7 +71,7 @@ repos:
- id: check-python-versions
args: ['--only', 'setup.py,pyproject.toml']
- repo: https://github.com/collective/i18ndude
rev: "6.2.0"
rev: "6.2.1"
hooks:
- id: i18ndude

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ target-version = ["py38"]
##

[tool.codespell]
ignore-words-list = "discreet,"
ignore-words-list = "discreet,assertin,"
skip = "*.po,*.js,*.min.js,*.min.js.map,*.min.css.map,*.svg,*.lock,*.json"
##
# Add extra configuration options in .meta.toml:
Expand Down Expand Up @@ -83,6 +83,7 @@ Zope = [
'Products.CMFCore', 'Products.CMFDynamicViewFTI',
]
python-dateutil = ['dateutil']
pytest-plone = ['pytest', 'zope.pytestlayer', 'plone.testing', 'plone.app.testing']

##
# Add extra configuration options in .meta.toml:
Expand Down
78 changes: 78 additions & 0 deletions src/collective/taxonomy/tests/robot/test_taxonomy.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
*** Settings ***

Resource plone/app/robotframework/browser.robot

Library Remote ${PLONE_URL}/RobotRemote
Library Collections

Test Setup Run Keywords Plone test setup
Test Teardown Run keywords Plone test teardown


*** Variables ***

${TITLE} An edited page
${PAGE_ID} an-edited-page


*** Test Cases ***

Scenario: As a manager I can add a taxonomy
Given a logged in manager
and an page type with a taxonomy
When I edit the page
and I select multiple options
Then I see '2' selected options

When I save the page
and I edit the page
and I deselect option 'Information Science'
Then I see '1' selected options

*** Keywords ***

# Given

a logged in manager
Enable autologin as Manager

an page type with a taxonomy
Create content
... type=Document
... title=${TITLE}

Go to ${PLONE_URL}/dexterity-types/Document/@@behaviors
Check Checkbox //input[@name="form.widgets.collective.taxonomy.generated.test:list"]
Click //button[@name="form.buttons.apply"]
Wait For Condition Text //body contains Behaviors successfully updated.

# When
I edit the page
Go to ${PLONE_URL}/${PAGE_ID}/edit
Get Text //body contains Edit Page

I select multiple options
Select Options By //select[@name="form.widgets.test.taxonomy_test.from"] index 0 2
Click //button[@name="from2toButton"]

I save the page
Click //button[@name="form.buttons.save"]
Wait For Condition Text //body contains Changes saved

I deselect option '${label}'
Select Options By //select[@name="form.widgets.test.taxonomy_test.to"] label ${label}
Click //button[@name="to2fromButton"]

# Then
I see '${count}' selected options
Get Element Count //select[@name="form.widgets.test.taxonomy_test.to"]/option should be ${count}

# Misc

Pause
[Documentation] Visually pause test execution with interactive dialog by
... importing **Dialogs**-library and calling its
... **Pause Execution**-keyword.
Import library Dialogs
Pause execution

105 changes: 0 additions & 105 deletions src/collective/taxonomy/tests/robot/todo_test_taxonomy.robot

This file was deleted.

2 changes: 0 additions & 2 deletions src/collective/taxonomy/widget_input.pt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  1. what about the second "multiple" in the to field?
  2. if multiple is missing, are there problems when saving multiple values?

Copy link
Member

@petschki petschki Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I see now that the multiple attribute is set in tal:attributes so its OK to remove it from the markup.

But TBH it smells a bit like a bug in Chameleon template rendering engine, because if I do multiple="" in the widget markup it gets replaced correctly with multiple="multiple" (thats what z3c.form OrderedSelect widget defines here: https://github.com/zopefoundation/z3c.form/blob/master/src/z3c/form/browser/orderedselect.py#L36) -> but according to the specs, those "boolean html attributes" should be handled correctly if they are present without a value (https://developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML)

So if you remove the second multiple in the to field too, this is approved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related 😉

collective/zpretty#123

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related 😉

collective/zpretty#123

Okay, a new task for the week ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Root cause: malthe/chameleon#429

Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ function selectionError() {
<td>
<select class=""
id="from"
multiple
name="from"
size="5"
style="width: 100%"
Expand Down Expand Up @@ -214,7 +213,6 @@ function selectionError() {
<td style="text-align: right">
<select class=""
id="to"
multiple
name="to"
size="5"
style="width: 100%"
Expand Down
Loading