You are here

public function BreakpointDiscoveryTest::testCustomBreakpointGroups in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php \Drupal\breakpoint\Tests\BreakpointDiscoveryTest::testCustomBreakpointGroups()

Test the custom breakpoint group provided by a theme and a module.

File

core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php, line 99
Contains \Drupal\breakpoint\Tests\BreakpointDiscoveryTest.

Class

BreakpointDiscoveryTest
Tests discovery of breakpoints provided by themes and modules.

Namespace

Drupal\breakpoint\Tests

Code

public function testCustomBreakpointGroups() {

  // Verify the breakpoint group for breakpoint_theme_test.group2 was created.
  $expected_breakpoints = array(
    'breakpoint_theme_test.group2.narrow' => array(
      'label' => 'narrow',
      'mediaQuery' => '(min-width: 560px)',
      'weight' => 0,
      'multipliers' => array(
        '1x',
        '2x',
      ),
      'provider' => 'breakpoint_theme_test',
      'id' => 'breakpoint_theme_test.group2.narrow',
      'group' => 'breakpoint_theme_test.group2',
      'class' => 'Drupal\\breakpoint\\Breakpoint',
    ),
    'breakpoint_theme_test.group2.wide' => array(
      'label' => 'wide',
      'mediaQuery' => '(min-width: 851px)',
      'weight' => 1,
      'multipliers' => array(
        '1x',
        '2x',
      ),
      'provider' => 'breakpoint_theme_test',
      'id' => 'breakpoint_theme_test.group2.wide',
      'group' => 'breakpoint_theme_test.group2',
      'class' => 'Drupal\\breakpoint\\Breakpoint',
    ),
    'breakpoint_module_test.breakpoint_theme_test.group2.tv' => array(
      'label' => 'tv',
      'mediaQuery' => '(min-width: 6000px)',
      'weight' => 2,
      'multipliers' => array(
        '1x',
      ),
      'provider' => 'breakpoint_module_test',
      'id' => 'breakpoint_module_test.breakpoint_theme_test.group2.tv',
      'group' => 'breakpoint_theme_test.group2',
      'class' => 'Drupal\\breakpoint\\Breakpoint',
    ),
  );
  $breakpoints = \Drupal::service('breakpoint.manager')
    ->getBreakpointsByGroup('breakpoint_theme_test.group2');
  foreach ($expected_breakpoints as $id => $expected_breakpoint) {
    $this
      ->assertEqual($expected_breakpoint, $breakpoints[$id]
      ->getPluginDefinition());
  }
}