Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects

OEL-486: Improve test coverage

Merged Francesco SARDARA requested to merge OEL-486-v2 into 1.x

Created by: drishu

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
43 $view = Views::getView('bef_test');
44 $view->storage->getDisplay('default');
45
46 $this->setBetterExposedOptions($view, [
47 'sort' => [
48 'plugin_id' => 'oe_whitelabel_float_end_sort',
49 ],
50 ]);
51
52 // Render the exposed form.
53 $this->renderExposedForm($view);
54 $crawler = new Crawler($this->content->__toString());
55
56 $widget = $crawler->filter('form.bef-exposed-form');
57 $this->assertCount(1, $widget);
58 $this->assertStringContainsString('float-lg-end d-none d-md-flex align-items-baseline', $widget->attr('class'));
  • Francesco SARDARA
  • Francesco SARDARA
  • Francesco SARDARA
    Francesco SARDARA @brummbar started a thread on commit 82374386
  • 45
    46 $this->setBetterExposedOptions($view, [
    47 'sort' => [
    48 'plugin_id' => 'oe_whitelabel_float_end_sort',
    49 ],
    50 ]);
    51
    52 // Render the exposed form.
    53 $this->renderExposedForm($view);
    54 $crawler = new Crawler($this->content->__toString());
    55
    56 $widget = $crawler->filter('form.bef-exposed-form');
    57 $this->assertCount(1, $widget);
    58 $this->assertStringContainsString('float-lg-end d-none d-md-flex align-items-baseline', $widget->attr('class'));
    59
    60 $view->destroy();
  • Francesco SARDARA
  • Francesco SARDARA
  • Francesco SARDARA
    Francesco SARDARA @brummbar started a thread on commit 82374386
  • 99 $title = $header->filter('h4.offcanvas-title');
    100 $this->assertSame('Facets form', $title->text());
    101 $button = $header->filter('button');
    102 $this->assertSame('offcanvas', $button->attr('data-bs-dismiss'));
    103 $this->assertSame('button', $button->attr('type'));
    104 $body = $offcanvas->filter('div.offcanvas-body.bcl-offcanvas');
    105 $this->assertCount(1, $body);
    106 $form = $body->filter('form.facets-form');
    107 $this->assertCount(1, $form);
    108 $button = $crawler->filter('button.btn-light.btn-lg');
    109 $this->assertSame('button', $button->attr('type'));
    110 $this->assertSame('#bcl-offcanvas', $button->attr('data-bs-target'));
    111 $this->assertSame('offcanvas', $button->attr('data-bs-toggle'));
    112 $this->assertStringContainsString('Facets form', $button->text());
    113 $icon = $button->filter('svg');
    114 $this->assertStringContainsString('/assets/icons/bcl-default-icons.svg#filter', $icon->html());
    • Created by: donquixote

      Some blank lines for visual separation?

      I am not sure about the assertions and selectors, but I can't think of any better. Let's keep them.

    • Created by: drishu

      I also dont like some selectors in one or two tests, but I think the ones in this test are fine, I grab parents like header or body or the offcanvas outer one and then assert the presence of some elements

  • Francesco SARDARA
  • Created by: escuriola

    Review: Approved

  • Created by: donquixote

    Review: Approved

  • Merged by: donquixote at 2022-04-29 10:29:33 UTC

  • merged manually

  • Please register or sign in to reply
    Loading