Skip to content

Control render using configuration #267

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

Merged
merged 2 commits into from
Feb 17, 2020

Conversation

BeyondEvil
Copy link
Contributor

Fixes: #239

@BeyondEvil BeyondEvil merged commit 0f6c16a into pytest-dev:master Feb 17, 2020
@Wramberg
Copy link

Wramberg commented Feb 18, 2020

@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
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
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