1
|
|
|
import { Border } from '../../../controls'; |
2
|
|
|
|
3
|
|
|
describe( 'Border Control', function() { |
4
|
|
|
let $target = $( '<div>' ), |
5
|
|
|
border = new Border( { target: $target } ), |
6
|
|
|
$control = border.render(); |
7
|
|
|
|
8
|
|
|
it( 'creates html', function() { |
9
|
|
|
expect( !! $control.html().length ).toEqual( true ); |
10
|
|
|
} ); |
11
|
|
|
|
12
|
|
|
it( 'refreshes values', function() { |
13
|
|
|
$target.css( 'border', '' ); |
14
|
|
|
expect( border.getValues() ).toEqual( { top: 0, right: 0, bottom: 0, left: 0 } ); |
15
|
|
|
$target.css( 'border', '1px solid green' ); |
16
|
|
|
border.refreshValues(); |
17
|
|
|
expect( border.getValues() ).toEqual( { top: 1, right: 1, bottom: 1, left: 1 } ); |
18
|
|
|
} ); |
19
|
|
|
|
20
|
|
|
it( 'shows border width', function() { |
21
|
|
|
$target.css( 'border', '2px dashed green' ); |
22
|
|
|
border.refreshValues(); |
23
|
|
|
expect( border.$typeControl.find( '.border-width-control' ).css( 'display' ) ).toEqual( 'block' ); |
24
|
|
|
} ); |
25
|
|
|
|
26
|
|
|
it( 'hides border width', function() { |
27
|
|
|
$target.css( 'border', '2px dashed green' ); |
28
|
|
|
border.refreshValues(); |
29
|
|
|
$target.css( 'border', '' ); |
30
|
|
|
border.refreshValues(); |
31
|
|
|
expect( border.$typeControl.find( '.border-width-control' ).css( 'display' ) ).toEqual( 'none' ); |
32
|
|
|
} ); |
33
|
|
|
} ); |
34
|
|
|
|