Skip to content

Control render using configuration - #267

Merged
BeyondEvil merged 2 commits into
pytest-dev:masterfrom
BeyondEvil:render-collapsed
Feb 17, 2020
Merged

BeyondEvil merged 2 commits into
pytest-dev:masterfrom
BeyondEvil:render-collapsed

Conversation

@BeyondEvil

Copy link
Copy Markdown
Contributor

Fixes: #239

Comment thread README.rst Outdated
Comment thread README.rst Outdated
@BeyondEvil
BeyondEvil merged commit 0f6c16a into pytest-dev:master Feb 17, 2020
@Wramberg

Wramberg commented Feb 18, 2020 •

Copy link
Copy Markdown

@BeyondEvil As agreed in #239 I gave this a shot. The render is must faster now but unfortunately the collapsed class is misplaced. This means it is no longer possible to unfold the details/extras. With this PR, setting render_collapsed=true yields

<tr>
  <td class="extra collapsed" colspan="4">
    <div>

but it should be

<tr class="collapsed">
  <td class="extra" colspan="4">
    <div>

By changing the implementation to the following it works for me

            if len(cells) > 0:
                tr_class = None
                if self.config.getini("render_collapsed"):
                    tr_class = "collapsed"

                self.row_table = html.tr(cells)
                self.row_extra = html.tr(
                    html.td(self.additional_html, class_="extra", colspan=len(cells)), class_=tr_class
                )

Essentially just moving the collapsed class to the parent html.tr().

@BeyondEvil

Copy link
Copy Markdown
Contributor Author

@BeyondEvil As agreed in #239 I gave this a shot. The render is must faster now but unfortunately the collapsed class is misplaced. This means it is no longer possible to unfold the details/extras. With this PR, setting render_collapsed=true yields

<tr>
  <td class="extra collapsed" colspan="4">
    <div>

but it should be

<tr class="collapsed">
  <td class="extra" colspan="4">
    <div>

By changing the implementation to the following it works for me

            if len(cells) > 0:
                tr_class = None
                if self.config.getini("render_collapsed"):
                    tr_class = "collapsed"

                self.row_table = html.tr(cells)
                self.row_extra = html.tr(
                    html.td(self.additional_html, class_="extra", colspan=len(cells)), class_=tr_class
                )

Essentially just moving the collapsed class to the parent html.tr().

lol, awkward.

Good catch! In the end it was good, because I noticed JS needed an update as well to display the correct CSS.

@BeyondEvil
BeyondEvil deleted the render-collapsed branch February 20, 2020 17:14
@BeyondEvil

Copy link
Copy Markdown
Contributor Author

Released in v2.1.0

@ssbarnea ssbarnea added the enhancement This issue/PR relates to a feature request. label Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This issue/PR relates to a feature request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening report is slow when it contains long logs

4 participants