fortitude-sass 0.6.5 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +12 -0
- data/.gitignore +3 -1
- data/.ruby-version +1 -1
- data/Gruntfile.js +73 -38
- data/app/assets/javascripts/fortitude/blocks/dropdown.js +44 -0
- data/app/assets/javascripts/fortitude/blocks/flashbar.js +24 -0
- data/app/assets/javascripts/fortitude/blocks/modal.js +50 -0
- data/app/assets/javascripts/fortitude/blocks/navigationbar.js +11 -0
- data/app/assets/javascripts/fortitude/blocks/select-input.js +38 -0
- data/app/assets/javascripts/fortitude/blocks/shade.js +28 -0
- data/app/assets/javascripts/fortitude/blocks/tabs.js +50 -0
- data/app/assets/javascripts/fortitude/generic/get-target.js +13 -0
- data/app/assets/javascripts/fortitude/generic/measure-scrollbar.js +21 -0
- data/app/assets/javascripts/fortitude/{jquery/generic → generic}/screen-lock.js +6 -2
- data/app/assets/javascripts/fortitude/generic/transition-with.js +57 -0
- data/app/assets/javascripts/fortitude/generic/viewport.js +21 -0
- data/app/assets/javascripts/fortitude/generic/wait-for-animation.js +27 -0
- data/app/assets/javascripts/fortitude.js +1 -0
- data/app/assets/stylesheets/fortitude/api/blocks/_badge.scss +1 -1
- data/app/assets/stylesheets/fortitude/api/blocks/_block-list.scss +2 -2
- data/app/assets/stylesheets/fortitude/api/blocks/_button.scss +1 -1
- data/app/assets/stylesheets/fortitude/api/blocks/_dropdown.scss +45 -0
- data/app/assets/stylesheets/fortitude/api/blocks/_flag.scss +2 -2
- data/app/assets/stylesheets/fortitude/api/blocks/_flashbar.scss +11 -1
- data/app/assets/stylesheets/fortitude/api/blocks/_input.scss +5 -2
- data/app/assets/stylesheets/fortitude/api/blocks/_layout.scss +2 -2
- data/app/assets/stylesheets/fortitude/api/blocks/_media.scss +2 -2
- data/app/assets/stylesheets/fortitude/api/blocks/_modal.scss +28 -0
- data/app/assets/stylesheets/fortitude/api/blocks/_navigationbar.scss +1 -0
- data/app/assets/stylesheets/fortitude/api/blocks/_shade.scss +11 -1
- data/app/assets/stylesheets/fortitude/api/blocks/_table.scss +5 -0
- data/app/assets/stylesheets/fortitude/api/blocks/_tabs-navigation.scss +3 -0
- data/app/assets/stylesheets/fortitude/api/blocks/_text.scss +3 -0
- data/app/assets/stylesheets/fortitude/api/blocks/_ui-list.scss +2 -2
- data/app/assets/stylesheets/fortitude/base/_hr.scss +2 -2
- data/app/assets/stylesheets/fortitude/base/_page.scss +0 -2
- data/app/assets/stylesheets/fortitude/blocks/_badge.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_bare-list.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_block-list.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_box.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_button.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_container.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_dropdown.scss +15 -0
- data/app/assets/stylesheets/fortitude/blocks/_flag.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_flashbar.scss +6 -0
- data/app/assets/stylesheets/fortitude/blocks/_fluid-container.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_inline-list.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_input.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_layout.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_list-navigation.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_media.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_modal.scss +8 -16
- data/app/assets/stylesheets/fortitude/blocks/_navigationbar.scss +5 -2
- data/app/assets/stylesheets/fortitude/blocks/_shade.scss +7 -0
- data/app/assets/stylesheets/fortitude/blocks/_table.scss +1 -6
- data/app/assets/stylesheets/fortitude/blocks/_tabs-navigation.scss +6 -0
- data/app/assets/stylesheets/fortitude/blocks/_tabs.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_text.scss +1 -3
- data/app/assets/stylesheets/fortitude/blocks/_tooltip.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_ui-list.scss +2 -0
- data/app/assets/stylesheets/fortitude/blocks/_wings.scss +3 -1
- data/app/assets/stylesheets/fortitude/generic/_normalize.scss +52 -15
- data/app/assets/stylesheets/fortitude/settings/_defaults.scss +1 -0
- data/app/assets/stylesheets/fortitude/theme/base/_page.scss +21 -0
- data/app/assets/stylesheets/fortitude/theme/extensions/_badge.scss +11 -0
- data/app/assets/stylesheets/fortitude/theme/extensions/_box.scss +11 -0
- data/app/assets/stylesheets/fortitude/theme/extensions/_button.scss +25 -0
- data/app/assets/stylesheets/fortitude/theme/extensions/_flashbar.scss +15 -0
- data/app/assets/stylesheets/fortitude/theme/extensions/_navigationbar.scss +51 -0
- data/app/assets/stylesheets/fortitude/theme/extensions/_wings.scss +15 -0
- data/app/assets/stylesheets/fortitude/theme/settings/_colors.scss +309 -0
- data/app/assets/stylesheets/fortitude/theme.scss +9 -0
- data/app/assets/stylesheets/fortitude/tools/_functions.scss +22 -13
- data/app/assets/stylesheets/fortitude/tools/_mixins.scss +10 -3
- data/app/assets/stylesheets/fortitude/trumps/_responsive-column.scss +1 -1
- data/app/assets/stylesheets/fortitude/trumps/_responsive-line-height.scss +1 -1
- data/app/assets/stylesheets/fortitude/trumps/_responsive-margin.scss +3 -3
- data/app/assets/stylesheets/fortitude/trumps/_responsive-padding.scss +1 -1
- data/app/assets/stylesheets/fortitude.scss +2 -0
- data/bower.json +1 -1
- data/jasmine/fixtures/animations.css +85 -0
- data/jasmine/fixtures/dropdownFixture.html +91 -0
- data/jasmine/fixtures/flashbarFixture.html +6 -0
- data/jasmine/fixtures/getTargetFixture.html +11 -0
- data/jasmine/fixtures/measureScrollBarFixture.html +1 -0
- data/jasmine/fixtures/modalFixture.html +20 -0
- data/jasmine/fixtures/navigationbarFixture.html +20 -0
- data/jasmine/fixtures/selectInputFixture.html +13 -0
- data/jasmine/fixtures/shadeFixture.html +2 -0
- data/jasmine/fixtures/tabsFixture.html +22 -0
- data/jasmine/fixtures/transitionWithFixture.html +6 -0
- data/jasmine/fixtures/viewportFixture.html +2 -0
- data/jasmine/fixtures/waitForAnimationFixture.html +1 -0
- data/jasmine/helpers/fixtureHelper.js +4 -0
- data/jasmine/helpers/multiCallbackHelper.js +24 -0
- data/jasmine/specs/blocks/dropdownSpec.js +106 -0
- data/jasmine/specs/blocks/flashbarSpec.js +22 -0
- data/jasmine/specs/blocks/modalSpec.js +66 -0
- data/jasmine/specs/blocks/navigationbarSpec.js +34 -0
- data/jasmine/specs/blocks/selectInputSpec.js +31 -0
- data/jasmine/specs/blocks/shadeSpec.js +38 -0
- data/jasmine/specs/blocks/tabsSpec.js +63 -0
- data/jasmine/specs/generic/getTargetSpec.js +28 -0
- data/jasmine/specs/generic/measureScrollbarSpec.js +19 -0
- data/jasmine/specs/generic/screenLockSpec.js +32 -0
- data/jasmine/specs/generic/transitionWithSpec.js +82 -0
- data/jasmine/specs/generic/viewportSpec.js +32 -0
- data/jasmine/specs/generic/waitForAnimationSpec.js +35 -0
- data/jasmine/template.tmpl +2 -0
- data/lib/fortitude-sass/version.rb +1 -1
- data/package.json +8 -2
- data/sass_specs/blocks/_shade_spec.scss +11 -0
- data/sass_specs/tests.scss +1 -0
- data/sass_specs/tools/_functions_spec.scss +42 -12
- metadata +59 -16
- data/app/assets/javascripts/fortitude/jquery/blocks/flashbar.js +0 -13
- data/app/assets/javascripts/fortitude/jquery/blocks/select-input.js +0 -26
- data/app/assets/javascripts/fortitude/jquery/blocks/shade.js +0 -36
- data/app/assets/javascripts/fortitude/jquery/generic/measure-scrollbar.js +0 -13
- data/app/assets/javascripts/fortitude/jquery/generic/viewport.js +0 -9
- data/app/assets/javascripts/fortitude/jquery/generic/wait-for-animation.js +0 -103
- data/app/assets/javascripts/fortitude/jquery/index.js +0 -3
- data/app/assets/javascripts/fortitude.jquery.js +0 -45
- data/dist/fortitude-theme.css +0 -9236
- data/dist/fortitude.css +0 -8976
- data/dist/fortitude.jquery.js +0 -1
- data/dist/fortitude.min.js +0 -1
@@ -0,0 +1,13 @@
|
|
1
|
+
<select class="select-input" id="select-with-placeholder">
|
2
|
+
<option class="placeholder" selected="true">
|
3
|
+
Placeholder option
|
4
|
+
</option>
|
5
|
+
<option value="2">Real option 1</option>
|
6
|
+
<option value="3">Real option 2</option>
|
7
|
+
</select>
|
8
|
+
|
9
|
+
<select class="select-input" id="select-without-placeholder">
|
10
|
+
<option >Placeholder option</option>
|
11
|
+
<option value="2">Real option 1</option>
|
12
|
+
<option value="3">Real option 2</option>
|
13
|
+
</select>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<ul class="tabs-navigation">
|
2
|
+
<li class="tabs-navigation__item" data-ft-tab="tab-one">
|
3
|
+
<a href="javascript:void(0);" class="tabs-navigation__link">
|
4
|
+
Item 1
|
5
|
+
</a>
|
6
|
+
</li>
|
7
|
+
<li class="tabs-navigation__item" data-ft-tab="tab-two">
|
8
|
+
<a href="javascript:void(0);" class="tabs-navigation__link">
|
9
|
+
Item 2
|
10
|
+
</a>
|
11
|
+
</li>
|
12
|
+
</ul>
|
13
|
+
|
14
|
+
<div class="tabs">
|
15
|
+
<div class="tabs__target" id="tab-one">
|
16
|
+
Content for tab 1
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="tabs__target" id="tab-two">
|
20
|
+
Content for tab 2
|
21
|
+
</div>
|
22
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div id="animate" class="animated tiny"></div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
(function(_){
|
2
|
+
// 'use strict';
|
3
|
+
|
4
|
+
_.mixin({
|
5
|
+
multiCallback: function(elementArr){
|
6
|
+
var deferred = $.Deferred(),
|
7
|
+
finished = [];
|
8
|
+
|
9
|
+
_.forEach(elementArr, function(spec){
|
10
|
+
var eventName = spec[0],
|
11
|
+
$element = spec[1];
|
12
|
+
|
13
|
+
$element.on(eventName, function(){
|
14
|
+
finished.push([eventName, $element]);
|
15
|
+
if(finished.length === elementArr.length){
|
16
|
+
deferred.resolve(finished);
|
17
|
+
}
|
18
|
+
});
|
19
|
+
});
|
20
|
+
|
21
|
+
return deferred.promise();
|
22
|
+
}
|
23
|
+
});
|
24
|
+
})(_);
|
@@ -0,0 +1,106 @@
|
|
1
|
+
(function($){
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
describe('.dropdown', function(){
|
5
|
+
var notChecked = '.dropdown__text:not(.dropdown__text--is-checked)',
|
6
|
+
checkNotVisible = function($dropdown){
|
7
|
+
expect($dropdown.find(notChecked)).toBeVisible();
|
8
|
+
expect($dropdown.find('.dropdown__text--is-checked')).not.toBeVisible();
|
9
|
+
expect($dropdown.find('.dropdown__navigation')).not.toBeVisible();
|
10
|
+
},
|
11
|
+
checkIsVisible = function($dropdown){
|
12
|
+
expect($dropdown.find(notChecked)).not.toBeVisible();
|
13
|
+
expect($dropdown.find('.dropdown__text--is-checked')).toBeVisible();
|
14
|
+
expect($dropdown.find('.dropdown__navigation')).toBeVisible();
|
15
|
+
},
|
16
|
+
checkDropdown = function($element){
|
17
|
+
$element.find('.dropdown__toggle').prop('checked', true).trigger('change');
|
18
|
+
},
|
19
|
+
$dropdowns;
|
20
|
+
|
21
|
+
beforeEach(function(){
|
22
|
+
loadFixtures('dropdownFixture.html');
|
23
|
+
$dropdowns = $('.dropdown');
|
24
|
+
});
|
25
|
+
|
26
|
+
it('is not open by default', function(){
|
27
|
+
checkNotVisible($dropdowns.eq(0));
|
28
|
+
});
|
29
|
+
|
30
|
+
it('becomes visible when checked', function(done){
|
31
|
+
var $dropdown = $dropdowns.eq(0);
|
32
|
+
checkDropdown($dropdown);
|
33
|
+
|
34
|
+
$dropdown.on('opened.ft.dropdown', function(){
|
35
|
+
checkIsVisible($dropdown);
|
36
|
+
$dropdowns.not($dropdowns.eq(0)).each(function(){
|
37
|
+
checkNotVisible($(this));
|
38
|
+
});
|
39
|
+
done();
|
40
|
+
});
|
41
|
+
});
|
42
|
+
|
43
|
+
it('hides dropdowns with the same data-ft-dropdown', function(done){
|
44
|
+
var $first = $dropdowns.eq(0),
|
45
|
+
$second = $dropdowns.eq(1);
|
46
|
+
|
47
|
+
checkDropdown($first);
|
48
|
+
$first.on('opened.ft.dropdown', function(){
|
49
|
+
checkDropdown($second);
|
50
|
+
});
|
51
|
+
|
52
|
+
$first.on('closed.ft.dropdown', function(){
|
53
|
+
checkNotVisible($first);
|
54
|
+
checkIsVisible($second);
|
55
|
+
done();
|
56
|
+
});
|
57
|
+
});
|
58
|
+
|
59
|
+
it('allows open dropdowns that do not have the same data-ft-dropdown', function(done){
|
60
|
+
var $first = $dropdowns.eq(0),
|
61
|
+
$second = $dropdowns.eq(2);
|
62
|
+
|
63
|
+
checkDropdown($first);
|
64
|
+
$first.on('opened.ft.dropdown', function(){
|
65
|
+
checkDropdown($second);
|
66
|
+
});
|
67
|
+
|
68
|
+
$second.on('opened.ft.dropdown', function(){
|
69
|
+
expect($first).not.toHaveClass('fadeOut');
|
70
|
+
checkIsVisible($second);
|
71
|
+
done();
|
72
|
+
});
|
73
|
+
});
|
74
|
+
|
75
|
+
it('hides fellow dropdowns, but not others', function(done){
|
76
|
+
var allFinished = [];
|
77
|
+
|
78
|
+
checkDropdown($dropdowns.eq(0));
|
79
|
+
checkDropdown($dropdowns.eq(2));
|
80
|
+
checkDropdown($dropdowns.eq(3));
|
81
|
+
|
82
|
+
// partner of 0
|
83
|
+
$dropdowns.eq(0).on('opened.ft.dropdown', function(){
|
84
|
+
checkDropdown($dropdowns.eq(1));
|
85
|
+
});
|
86
|
+
|
87
|
+
// partner of 3
|
88
|
+
$dropdowns.eq(3).on('opened.ft.dropdown', function(){
|
89
|
+
checkDropdown($dropdowns.eq(4));
|
90
|
+
});
|
91
|
+
|
92
|
+
_.multiCallback([
|
93
|
+
['opened.ft.dropdown', $dropdowns.eq(2)],
|
94
|
+
['closed.ft.dropdown', $dropdowns.eq(0)],
|
95
|
+
['closed.ft.dropdown', $dropdowns.eq(3)]
|
96
|
+
]).then(function(){
|
97
|
+
checkIsVisible($dropdowns.eq(1));
|
98
|
+
checkIsVisible($dropdowns.eq(2));
|
99
|
+
checkNotVisible($dropdowns.eq(0));
|
100
|
+
checkIsVisible($dropdowns.eq(4));
|
101
|
+
checkNotVisible($dropdowns.eq(3));
|
102
|
+
done();
|
103
|
+
});
|
104
|
+
});
|
105
|
+
});
|
106
|
+
})(jQuery);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
(function($){
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
describe(".flashbar", function(){
|
5
|
+
var $flashbar;
|
6
|
+
|
7
|
+
beforeEach(function(){
|
8
|
+
loadFixtures('flashbarFixture.html');
|
9
|
+
$flashbar = $('.flashbar');
|
10
|
+
});
|
11
|
+
|
12
|
+
it('removes flashbar when close is clicked', function(done){
|
13
|
+
$flashbar.find('.flashbar__close').trigger('click');
|
14
|
+
$flashbar.on('closed.ft.flashbar', function(){
|
15
|
+
expect($flashbar).toHaveClass('flashbar--closed');
|
16
|
+
expect($flashbar).not.toBeVisible();
|
17
|
+
done();
|
18
|
+
});
|
19
|
+
});
|
20
|
+
});
|
21
|
+
|
22
|
+
})(jQuery);
|
@@ -0,0 +1,66 @@
|
|
1
|
+
(function($){
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
describe(".modal", function(){
|
5
|
+
var $modal, $animatedModal, $button, $animateButton, $shade, $closeButton;
|
6
|
+
|
7
|
+
beforeEach(function(){
|
8
|
+
loadFixtures('modalFixture.html');
|
9
|
+
$modal = $('#example-modal');
|
10
|
+
$button = $('button[data-ft-modal="example-modal"]');
|
11
|
+
$closeButton = $('button[data-ft-modal-close]');
|
12
|
+
$shade = $('.shade');
|
13
|
+
});
|
14
|
+
|
15
|
+
it('is not visible by default', function(){
|
16
|
+
expect($shade).not.toBeVisible();
|
17
|
+
expect($modal).not.toBeVisible();
|
18
|
+
});
|
19
|
+
|
20
|
+
it('shows modal on data-ft-modal click', function(done){
|
21
|
+
$button.trigger('click');
|
22
|
+
_.multiCallback([
|
23
|
+
['opened.ft.shade', $shade],
|
24
|
+
['opened.ft.modal', $modal]
|
25
|
+
]).then(function(){
|
26
|
+
expect($shade).toBeVisible();
|
27
|
+
expect($modal).toBeVisible();
|
28
|
+
done();
|
29
|
+
});
|
30
|
+
});
|
31
|
+
|
32
|
+
it('hides modal on data-ft-modal-close click', function(done){
|
33
|
+
$modal.trigger('open.ft.modal');
|
34
|
+
$modal.on('opened.ft.modal', function(){
|
35
|
+
$closeButton.trigger('click');
|
36
|
+
});
|
37
|
+
|
38
|
+
_.multiCallback([
|
39
|
+
['closed.ft.shade', $shade],
|
40
|
+
['closed.ft.modal', $modal]
|
41
|
+
]).then(function(){
|
42
|
+
expect($shade).not.toBeVisible();
|
43
|
+
expect($modal).not.toBeVisible();
|
44
|
+
done();
|
45
|
+
});
|
46
|
+
|
47
|
+
});
|
48
|
+
|
49
|
+
it('hides modal on .shade click', function(done){
|
50
|
+
$modal.trigger('open.ft.modal');
|
51
|
+
$modal.on('opened.ft.modal', function(){
|
52
|
+
$shade.trigger('click');
|
53
|
+
});
|
54
|
+
|
55
|
+
_.multiCallback([
|
56
|
+
['closed.ft.shade', $shade],
|
57
|
+
['closed.ft.modal', $modal]
|
58
|
+
]).then(function(){
|
59
|
+
expect($shade).not.toBeVisible();
|
60
|
+
expect($modal).not.toBeVisible();
|
61
|
+
done();
|
62
|
+
});
|
63
|
+
});
|
64
|
+
});
|
65
|
+
|
66
|
+
})(jQuery);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
(function($){
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
describe(".navigationbar", function(){
|
5
|
+
var $navbar, $shade;
|
6
|
+
|
7
|
+
beforeEach(function(){
|
8
|
+
loadFixtures('navigationbarFixture.html');
|
9
|
+
$navbar = $('.navigationbar');
|
10
|
+
$shade = $('.shade');
|
11
|
+
});
|
12
|
+
|
13
|
+
it('does not have the shade open by default', function(){
|
14
|
+
expect($shade).not.toBeVisible();
|
15
|
+
});
|
16
|
+
|
17
|
+
it('opens the shade when toggle helper checked', function(done){
|
18
|
+
$navbar.find('.navigationbar__toggle__helper').trigger('click');
|
19
|
+
$shade.on('opened.ft.shade', function(){
|
20
|
+
expect($shade).toBeVisible();
|
21
|
+
done();
|
22
|
+
});
|
23
|
+
});
|
24
|
+
|
25
|
+
it('closes the shade when toggle helper unchecked', function(done){
|
26
|
+
$navbar.find('.navigationbar__toggle__helper').trigger('click');
|
27
|
+
$navbar.find('.navigationbar__toggle__helper').trigger('click');
|
28
|
+
$shade.on('closed.ft.shade', function(){
|
29
|
+
expect($shade).not.toBeVisible();
|
30
|
+
done();
|
31
|
+
});
|
32
|
+
});
|
33
|
+
});
|
34
|
+
})(jQuery);
|
@@ -0,0 +1,31 @@
|
|
1
|
+
(function($){
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
describe('.select-input', function(){
|
5
|
+
var $select, $noPlaceholder;
|
6
|
+
|
7
|
+
beforeEach(function(){
|
8
|
+
loadFixtures('selectInputFixture.html');
|
9
|
+
$select = $('#select-with-placeholder');
|
10
|
+
$noPlaceholder = $('#select-without-placeholder');
|
11
|
+
$(document).trigger('setup.ft.select');
|
12
|
+
});
|
13
|
+
|
14
|
+
it('shows the default options class by default', function(){
|
15
|
+
expect($select).toHaveClass('select-input');
|
16
|
+
expect($select).toHaveClass('placeholder');
|
17
|
+
});
|
18
|
+
|
19
|
+
it('removes the class when the option changes', function(){
|
20
|
+
$select.val(2).trigger('change');
|
21
|
+
expect($select).toHaveClass('select-input');
|
22
|
+
expect($select).not.toHaveClass('placeholder');
|
23
|
+
});
|
24
|
+
|
25
|
+
it('does not set placeholders when no classes present', function(){
|
26
|
+
expect($noPlaceholder).not.toHaveClass('placeholder');
|
27
|
+
$noPlaceholder.val(2).trigger('change');
|
28
|
+
expect($noPlaceholder).not.toHaveClass('placeholder');
|
29
|
+
});
|
30
|
+
});
|
31
|
+
})(jQuery);
|
@@ -0,0 +1,38 @@
|
|
1
|
+
(function($){
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
describe(".shade", function(){
|
5
|
+
var $shade;
|
6
|
+
|
7
|
+
beforeEach(function(){
|
8
|
+
loadFixtures('shadeFixture.html');
|
9
|
+
$shade = $('.shade');
|
10
|
+
});
|
11
|
+
|
12
|
+
it("is not immediately visible", function(){
|
13
|
+
expect($shade).not.toBeVisible();
|
14
|
+
});
|
15
|
+
|
16
|
+
it("is visible after event trigger", function(done){
|
17
|
+
$('[data-ft-shade]').trigger('click');
|
18
|
+
$shade.on('opened.ft.shade', function(){
|
19
|
+
expect($shade).toHaveClass('shade--is-active');
|
20
|
+
expect($shade).toBeVisible();
|
21
|
+
done();
|
22
|
+
});
|
23
|
+
});
|
24
|
+
|
25
|
+
it("closes when clicked on", function(done){
|
26
|
+
$shade.trigger('open.ft.shade');
|
27
|
+
$shade.on('opened.ft.shade', function(){
|
28
|
+
expect($shade).toHaveClass('shade--is-active');
|
29
|
+
$shade.trigger('click');
|
30
|
+
});
|
31
|
+
|
32
|
+
$shade.on('closed.ft.shade', function(){
|
33
|
+
expect($shade).not.toBeVisible();
|
34
|
+
done();
|
35
|
+
});
|
36
|
+
});
|
37
|
+
});
|
38
|
+
})(jQuery);
|
@@ -0,0 +1,63 @@
|
|
1
|
+
(function($){
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
describe('.tabs-navigation and .tabs', function(){
|
5
|
+
var itemActive = 'tabs-navigation__item--is-active',
|
6
|
+
targetActive = 'tabs__target--is-active',
|
7
|
+
$itemOne, $itemTwo, $targetOne, $targetTwo;
|
8
|
+
|
9
|
+
beforeEach(function(){
|
10
|
+
loadFixtures('tabsFixture.html');
|
11
|
+
$itemOne = $('[data-ft-tab="tab-one"]');
|
12
|
+
$targetOne = $('#tab-one');
|
13
|
+
|
14
|
+
$itemTwo = $('[data-ft-tab="tab-two"]');
|
15
|
+
$targetTwo = $('#tab-two');
|
16
|
+
});
|
17
|
+
|
18
|
+
it('does not show tabs by default', function(){
|
19
|
+
expect($itemOne).not.toHaveClass(itemActive);
|
20
|
+
expect($itemTwo).not.toHaveClass(itemActive);
|
21
|
+
expect($targetOne).not.toBeVisible();
|
22
|
+
expect($targetTwo).not.toBeVisible();
|
23
|
+
});
|
24
|
+
|
25
|
+
it('shows tab one on click', function(done){
|
26
|
+
$itemOne.trigger('click');
|
27
|
+
_.multiCallback([
|
28
|
+
['opened.ft.tab', $itemOne],
|
29
|
+
['opened.ft.tabtarget', $targetOne]
|
30
|
+
]).then(function(){
|
31
|
+
expect($itemOne).toHaveClass(itemActive);
|
32
|
+
expect($itemTwo).not.toHaveClass(itemActive);
|
33
|
+
|
34
|
+
expect($targetOne).toHaveClass(targetActive);
|
35
|
+
expect($targetOne).toBeVisible();
|
36
|
+
|
37
|
+
expect($targetTwo).not.toHaveClass(targetActive);
|
38
|
+
expect($targetTwo).not.toBeVisible();
|
39
|
+
done();
|
40
|
+
});
|
41
|
+
});
|
42
|
+
|
43
|
+
it('marks other tabs as inactive', function(done){
|
44
|
+
$itemOne.trigger('select.ft.tab');
|
45
|
+
$itemTwo.trigger('select.ft.tab');
|
46
|
+
|
47
|
+
_.multiCallback([
|
48
|
+
['opened.ft.tab', $itemTwo],
|
49
|
+
['opened.ft.tabtarget', $targetTwo]
|
50
|
+
]).then(function(){
|
51
|
+
expect($itemOne).not.toHaveClass(itemActive);
|
52
|
+
expect($itemTwo).toHaveClass(itemActive);
|
53
|
+
|
54
|
+
expect($targetOne).not.toHaveClass(targetActive);
|
55
|
+
expect($targetOne).not.toBeVisible();
|
56
|
+
|
57
|
+
expect($targetTwo).toHaveClass(targetActive);
|
58
|
+
expect($targetTwo).toBeVisible();
|
59
|
+
done();
|
60
|
+
});
|
61
|
+
});
|
62
|
+
});
|
63
|
+
})(jQuery);
|