Skip to content

Commit

Permalink
Merge 498e67f into 4764f40
Browse files Browse the repository at this point in the history
  • Loading branch information
bsquizz committed Apr 26, 2019
2 parents 4764f40 + 498e67f commit 467cf43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/widgetastic/widget/table.py
Expand Up @@ -385,7 +385,7 @@ class MyCustomTable(Table):

# These tags are not added as Node objects to the table tree when
# _process_table is called.
IGNORE_TAGS = ['caption']
IGNORE_TAGS = ['caption', 'thead', 'tfoot', 'colgroup']

ROW_TAG = 'tr'
COLUMN_TAG = 'td'
Expand Down
22 changes: 2 additions & 20 deletions testing/test_basic_widgets.py
Expand Up @@ -5,7 +5,7 @@

from widgetastic.exceptions import DoNotReadThisWidget
from widgetastic.widget import (
View, Table, Text, TextInput, FileInput, Checkbox, Select, ColourInput, Widget)
View, Table, Text, TextInput, FileInput, Checkbox, Select, ColourInput)
from widgetastic.widget.table import TableRow
from widgetastic.utils import Fillable, ParametrizedString, VersionPick, Version

Expand Down Expand Up @@ -345,17 +345,9 @@ class TBodyRow(TableRow):
HIDDEN_CONTENT = "./tr[2]/td[1]"

def __init__(self, parent, index, logger=None):
Widget.__init__(self, parent, logger=logger)
# We don't need to adjust index by +1 because anytree Node position will
# already be '+1' due to presence of 'thead' among the 'tbody' rows
self.index = index
super(TBodyRow, self).__init__(parent, index, logger=logger)
self.hidden_content = Text(parent=self, locator=self.HIDDEN_CONTENT)

def __locator__(self):
# We don't need to adjust index by +1 because anytree Node position will
# already be '+1' due to presence of 'thead' among the 'tbody' rows
return self.parent.ROW_AT_INDEX.format(self.index)

@property
def is_displayed(self):
return self.browser.is_displayed(self.ROW, parent=self)
Expand All @@ -369,16 +361,6 @@ class TBodyTable(Table):
ROW_TAG = "tbody"
Row = TBodyRow

@property
def _is_header_in_body(self):
"""Override this to always return true.
Since we are resolving rows by the 'tbody' tag, widgetastic.Table._process_table
creates the rows with a position starting at 1 (because a <thead> tag is present
when enumerating through the <table> tag's children)
"""
return True

class TestForm(View):
table1 = TBodyTable(
'#multiple_tbody_table',
Expand Down

0 comments on commit 467cf43

Please sign in to comment.