Skip to content

fix(GlPagination): move attributes to root element

Paul Gascou-Vaillancourt requested to merge fix-pagination-root-el into main

What does this MR do?

In !3100 (merged), we added a <nav> wrapper to GlPagination's template, but we left the attributes and v-if on the <ul> element, which slight changes the component's behavior. Previously, it would be possible for the component to not render anything, but with this new structure, there is always at least the root <nav>. This might be causing unintended effects, so this MR moves the attributes and v-if to the root element.

Note that this caused a Jest failure in a GitLab test that seems to rely on the component not rendering anything: https://gitlab.com/gitlab-org/gitlab/-/jobs/3225202263

FAIL spec/frontend/cycle_analytics/stage_table_spec.js
  ● StageTable › Pagination › with `hasNextPage=false › will not display the pagination component
    expect(received).toBe(expected) // Object.is equality
    Expected: false
    Received: true
      287 |
      288 |       it('will not display the pagination component', () => {
    > 289 |         expect(findPagination().exists()).toBe(false);
          |                                           ^
      290 |       });
      291 |     });
      292 |   });
      at Object.<anonymous> (spec/frontend/cycle_analytics/stage_table_spec.js:289:43)

Merge request reports

Loading