Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
breakpoint_module_test.mobile:
|
||||
label: mobile
|
||||
mediaQuery: '(min-width: 0px)'
|
||||
weight: 1
|
||||
# Don't include multipliers. A 1x multiplier this will be enforced by default.
|
||||
breakpoint_module_test.standard:
|
||||
label: standard
|
||||
mediaQuery: '(min-width: 560px)'
|
||||
weight: 0
|
||||
# Don't include a 1x multiplier this will be enforced by default.
|
||||
multipliers:
|
||||
- 2x
|
||||
# Test providing a breakpoint for group matching the group provided by
|
||||
# breakpoint_test_theme.
|
||||
breakpoint_module_test.breakpoint_theme_test.group2.tv:
|
||||
label: tv
|
||||
mediaQuery: '(min-width: 6000px)'
|
||||
weight: 0
|
||||
multipliers:
|
||||
- 1x
|
||||
group: breakpoint_theme_test.group2
|
|
@ -0,0 +1,7 @@
|
|||
name: 'Breakpoint test module'
|
||||
type: module
|
||||
description: 'Test module for breakpoint.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
|
122
core/modules/breakpoint/tests/src/Unit/BreakpointTest.php
Normal file
122
core/modules/breakpoint/tests/src/Unit/BreakpointTest.php
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\breakpoint\Unit\BreakpointTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\breakpoint\Unit;
|
||||
|
||||
use Drupal\breakpoint\Breakpoint;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\breakpoint\Breakpoint
|
||||
* @group Breakpoint
|
||||
*/
|
||||
class BreakpointTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* The used plugin ID.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $pluginId = 'breakpoint';
|
||||
|
||||
/**
|
||||
* The used plugin definition.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $pluginDefinition = array(
|
||||
'id' => 'breakpoint',
|
||||
);
|
||||
|
||||
/**
|
||||
* The breakpoint under test.
|
||||
*
|
||||
* @var \Drupal\breakpoint\Breakpoint
|
||||
*/
|
||||
protected $breakpoint;
|
||||
|
||||
/**
|
||||
* The mocked translator.
|
||||
*
|
||||
* @var \Drupal\Core\StringTranslation\TranslationInterface|\PHPUnit_Framework_MockObject_MockObject
|
||||
*/
|
||||
protected $stringTranslation;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->stringTranslation = $this->getMock('Drupal\Core\StringTranslation\TranslationInterface');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the breakpoint defaults.
|
||||
*/
|
||||
protected function setupBreakpoint() {
|
||||
$this->breakpoint = new Breakpoint(array(), $this->pluginId, $this->pluginDefinition);
|
||||
$this->breakpoint->setStringTranslation($this->stringTranslation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getLabel
|
||||
*/
|
||||
public function testGetLabel() {
|
||||
$this->pluginDefinition['label'] = 'Test label';
|
||||
$this->stringTranslation->expects($this->once())
|
||||
->method('translate')
|
||||
->with($this->pluginDefinition['label'], array(), array('context' => 'breakpoint'))
|
||||
->will($this->returnValue('Test label translated'));
|
||||
$this->setupBreakpoint();
|
||||
$this->assertEquals('Test label translated', $this->breakpoint->getLabel());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getWeight
|
||||
*/
|
||||
public function testGetWeight() {
|
||||
$this->pluginDefinition['weight'] = '4';
|
||||
$this->setupBreakpoint();
|
||||
// Assert that the type returned in an integer.
|
||||
$this->assertSame(4, $this->breakpoint->getWeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getMediaQuery
|
||||
*/
|
||||
public function testGetMediaQuery() {
|
||||
$this->pluginDefinition['mediaQuery'] = 'only screen and (min-width: 1220px)';
|
||||
$this->setupBreakpoint();
|
||||
$this->assertEquals('only screen and (min-width: 1220px)', $this->breakpoint->getMediaQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getMultipliers
|
||||
*/
|
||||
public function testGetMultipliers() {
|
||||
$this->pluginDefinition['multipliers'] = array('1x', '2x');
|
||||
$this->setupBreakpoint();
|
||||
$this->assertSame(array('1x', '2x'), $this->breakpoint->getMultipliers());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getProvider
|
||||
*/
|
||||
public function testGetProvider() {
|
||||
$this->pluginDefinition['provider'] = 'Breakpoint';
|
||||
$this->setupBreakpoint();
|
||||
$this->assertEquals('Breakpoint', $this->breakpoint->getProvider());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::getGroup
|
||||
*/
|
||||
public function testGetGroup() {
|
||||
$this->pluginDefinition['group'] = 'Breakpoint';
|
||||
$this->setupBreakpoint();
|
||||
$this->assertEquals('Breakpoint', $this->breakpoint->getGroup());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
breakpoint_theme_test.mobile:
|
||||
label: mobile
|
||||
mediaQuery: '(min-width: 0px)'
|
||||
weight: 3
|
||||
multipliers:
|
||||
- 1x
|
||||
breakpoint_theme_test.narrow:
|
||||
label: narrow
|
||||
mediaQuery: '(min-width: 560px)'
|
||||
weight: 2
|
||||
multipliers:
|
||||
- 1x
|
||||
# Out of order breakpoint to test sorting.
|
||||
breakpoint_theme_test.tv:
|
||||
label: tv
|
||||
mediaQuery: 'only screen and (min-width: 1220px)'
|
||||
weight: 0
|
||||
multipliers:
|
||||
- 1x
|
||||
breakpoint_theme_test.wide:
|
||||
label: wide
|
||||
mediaQuery: '(min-width: 851px)'
|
||||
weight: 1
|
||||
multipliers:
|
||||
- 1x
|
||||
breakpoint_theme_test.group2.narrow:
|
||||
label: narrow
|
||||
mediaQuery: '(min-width: 560px)'
|
||||
weight: 2
|
||||
multipliers:
|
||||
- 1x
|
||||
- 2x
|
||||
group: breakpoint_theme_test.group2
|
||||
breakpoint_theme_test.group2.wide:
|
||||
label: wide
|
||||
mediaQuery: '(min-width: 851px)'
|
||||
weight: 1
|
||||
multipliers:
|
||||
- 1x
|
||||
- 2x
|
||||
group: breakpoint_theme_test.group2
|
|
@ -0,0 +1,6 @@
|
|||
name: 'Breakpoint test theme'
|
||||
type: theme
|
||||
description: 'Test theme for breakpoint.'
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
base theme: bartik
|
Reference in a new issue