booties 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +172 -0
- data/Rakefile +5 -4
- data/app/controllers/booties/application_controller.rb +4 -1
- data/app/helpers/booties/application_helper.rb +3 -26
- data/app/helpers/booties/badge_helper.rb +6 -3
- data/app/helpers/booties/breadcrumb_helper.rb +29 -0
- data/app/helpers/booties/button_helper.rb +10 -8
- data/app/helpers/booties/dropdown_helper.rb +71 -0
- data/app/helpers/booties/flag_helper.rb +7 -4
- data/app/helpers/booties/modal_helper.rb +4 -1
- data/app/helpers/booties/panel_helper.rb +3 -1
- data/app/helpers/booties/popover_helper.rb +28 -19
- data/app/helpers/booties/tooltip_helper.rb +12 -8
- data/config/routes.rb +2 -0
- data/lib/booties.rb +3 -1
- data/lib/booties/engine.rb +7 -1
- data/lib/booties/modal.rb +13 -12
- data/lib/booties/panel.rb +21 -18
- data/lib/booties/utils.rb +8 -10
- data/lib/booties/version.rb +3 -1
- data/lib/tasks/booties_tasks.rake +2 -0
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +0 -4
- data/test/dummy/app/controllers/samples_controller.rb +28 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +9 -11
- data/test/dummy/app/views/samples/badges.html.erb +2 -0
- data/test/dummy/app/views/{home → samples}/breadcrumbs.html.erb +2 -1
- data/test/dummy/app/views/samples/buttons.html.erb +2 -0
- data/test/dummy/app/views/samples/dropdowns.html.erb +6 -0
- data/test/dummy/app/views/samples/flags.html.erb +2 -0
- data/test/dummy/app/views/samples/modals.html.erb +12 -0
- data/test/dummy/app/views/samples/panels.html.erb +14 -0
- data/test/dummy/app/views/samples/popovers.html.erb +9 -0
- data/test/dummy/app/views/samples/tooltips.html.erb +3 -0
- data/test/dummy/bin/bundle +1 -1
- data/test/dummy/bin/rails +1 -1
- data/test/dummy/bin/setup +17 -13
- data/test/dummy/bin/update +28 -0
- data/test/dummy/config.ru +2 -1
- data/test/dummy/config/application.rb +13 -12
- data/test/dummy/config/boot.rb +2 -2
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +24 -16
- data/test/dummy/config/environments/production.rb +23 -28
- data/test/dummy/config/environments/test.rb +5 -11
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +6 -1
- data/test/dummy/config/locales/en.yml +10 -0
- data/test/dummy/config/puma.rb +34 -0
- data/test/dummy/config/routes.rb +16 -8
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/log/test.log +11202 -19551
- data/test/dummy/public/404.html +6 -6
- data/test/dummy/public/422.html +6 -6
- data/test/dummy/public/500.html +6 -6
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/33/33EUCQBNqL6TOaGyMFn9wz2v39pHMJ4LOUUFUteIHHM.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/3N/3NnKgR2TsTI1qCXKZpts0uJzp2dRJcoYp3nnFU6YE4o.cache +2 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/7Q/7Q2gtOOyCVPFrfYz4KjmXJsM_m8Yra4MjgsQmfVGxZY.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/8c/8cROjTzeZZQaOFNLPKGuMtXO7EHxNfiEa72qt65UoF4.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/F6/F6RhC2MbCvVanNZZe44hqlJNKAdIrH4NUzRxj5N2_EQ.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Fc/FcMeZRcfG4LrhIhl3xrAg3EhSZInU4efHmUrjIs4keE.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/H3/H3dfPRbxbWIB6dQXrQ6xA9nDJqy4dOq1ujslocGVY9U.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/LK/LKisVDbQmzgRQKdFoNH5tRbTr72CrlM_2q7MZczv2Pg.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Mj/MjwYGG9GkHD1fwwH2bg66EBYl3zCA_mqeDF9otey4-U.cache +3 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Pc/Pce9HMZhc6XmsNfLUN84Enw7mySJ7ZYzys9mXmCVXqA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Po/PoftKmjB8lzW06EMKeru1CsqVtULc0MsiTysT2JNqvU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Su/SuILTE3Es0N_r-36Ddu2E6h49WcwH_-RsZyG4SPwKFQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/cJ/cJG59MHf0x4qJKYES0pa0nLpOFpFF7YwrrvIVKIixyA.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/fw/fwPYklzExHPpgeuv53ew_8OIpJVRyaHj2Jtj2JP9j5A.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/jc/jc_TR7ZZTSFDDRKdgc-KnZskUESr2rLOqcYZej83LvU.cache +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/rV/rVy4-idUuK0Va9FLw3G8pYeZFwJAwmvs_bQcbq6_Cd0.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/rY/rYyeRvy3oIuNfWeDhoriNlAlVjN4Wg4A3_9_OTDFin4.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/tY/tYFbDrMNElXwgmisit50aNXJvRU2zlIFk5g-EJ1CQTc.cache +0 -0
- data/test/helpers/booties/badge_helper_test.rb +7 -5
- data/test/helpers/booties/breadcrumb_helper_test.rb +13 -0
- data/test/helpers/booties/button_helper_test.rb +14 -12
- data/test/helpers/booties/dropdown_helper_test.rb +43 -0
- data/test/helpers/booties/flag_helper_test.rb +7 -5
- data/test/helpers/booties/modal_helper_test.rb +9 -7
- data/test/helpers/booties/panel_helper_test.rb +4 -2
- data/test/helpers/booties/popover_helper_test.rb +33 -42
- data/test/helpers/booties/tooltip_helper_test.rb +19 -40
- data/test/integration/samples_test.rb +103 -0
- data/test/lib/booties/modal_test.rb +193 -0
- data/test/{booties → lib/booties}/panel_test.rb +40 -22
- data/test/lib/booties/utils_test.rb +41 -0
- data/test/stub_view.rb +14 -7
- data/test/test_helper.rb +10 -11
- metadata +124 -98
- data/app/assets/javascripts/booties/application.js +0 -13
- data/app/assets/stylesheets/booties/application.css +0 -15
- data/test/booties/modal_test.rb +0 -170
- data/test/booties/utils_test.rb +0 -26
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/assets/javascripts/home.js +0 -2
- data/test/dummy/app/assets/stylesheets/home.css +0 -4
- data/test/dummy/app/controllers/home_controller.rb +0 -25
- data/test/dummy/app/helpers/home_helper.rb +0 -2
- data/test/dummy/app/views/home/badge.html.erb +0 -3
- data/test/dummy/app/views/home/button.html.erb +0 -2
- data/test/dummy/app/views/home/flag.html.erb +0 -5
- data/test/dummy/app/views/home/modal.html.erb +0 -16
- data/test/dummy/app/views/home/panel.html.erb +0 -25
- data/test/dummy/app/views/home/popover.html.erb +0 -7
- data/test/dummy/app/views/home/tooltip.html.erb +0 -7
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/locales/booties.yml +0 -4
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/log/development.log +0 -420
- data/test/dummy/test/controllers/home_controller_test.rb +0 -108
- data/test/helpers/booties/application_helper_test.rb +0 -11
- data/test/integration/navigation_test.rb +0 -9
data/test/dummy/public/404.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
6
|
<style>
|
|
7
|
-
|
|
7
|
+
.rails-default-error-page {
|
|
8
8
|
background-color: #EFEFEF;
|
|
9
9
|
color: #2E2F30;
|
|
10
10
|
text-align: center;
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
margin: 0;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
div.dialog {
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
16
|
width: 95%;
|
|
17
17
|
max-width: 33em;
|
|
18
18
|
margin: 4em auto 0;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
div.dialog > div {
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
22
|
border: 1px solid #CCC;
|
|
23
23
|
border-right-color: #999;
|
|
24
24
|
border-left-color: #999;
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
h1 {
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
35
|
font-size: 100%;
|
|
36
36
|
color: #730E15;
|
|
37
37
|
line-height: 1.5em;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
div.dialog > p {
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
41
|
margin: 0 0 1em;
|
|
42
42
|
padding: 1em;
|
|
43
43
|
background-color: #F7F7F7;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
</style>
|
|
55
55
|
</head>
|
|
56
56
|
|
|
57
|
-
<body>
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
58
|
<!-- This file lives in public/404.html -->
|
|
59
59
|
<div class="dialog">
|
|
60
60
|
<div>
|
data/test/dummy/public/422.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<title>The change you wanted was rejected (422)</title>
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
6
|
<style>
|
|
7
|
-
|
|
7
|
+
.rails-default-error-page {
|
|
8
8
|
background-color: #EFEFEF;
|
|
9
9
|
color: #2E2F30;
|
|
10
10
|
text-align: center;
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
margin: 0;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
div.dialog {
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
16
|
width: 95%;
|
|
17
17
|
max-width: 33em;
|
|
18
18
|
margin: 4em auto 0;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
div.dialog > div {
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
22
|
border: 1px solid #CCC;
|
|
23
23
|
border-right-color: #999;
|
|
24
24
|
border-left-color: #999;
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
h1 {
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
35
|
font-size: 100%;
|
|
36
36
|
color: #730E15;
|
|
37
37
|
line-height: 1.5em;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
div.dialog > p {
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
41
|
margin: 0 0 1em;
|
|
42
42
|
padding: 1em;
|
|
43
43
|
background-color: #F7F7F7;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
</style>
|
|
55
55
|
</head>
|
|
56
56
|
|
|
57
|
-
<body>
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
58
|
<!-- This file lives in public/422.html -->
|
|
59
59
|
<div class="dialog">
|
|
60
60
|
<div>
|
data/test/dummy/public/500.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<title>We're sorry, but something went wrong (500)</title>
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
6
|
<style>
|
|
7
|
-
|
|
7
|
+
.rails-default-error-page {
|
|
8
8
|
background-color: #EFEFEF;
|
|
9
9
|
color: #2E2F30;
|
|
10
10
|
text-align: center;
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
margin: 0;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
div.dialog {
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
16
|
width: 95%;
|
|
17
17
|
max-width: 33em;
|
|
18
18
|
margin: 4em auto 0;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
div.dialog > div {
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
22
|
border: 1px solid #CCC;
|
|
23
23
|
border-right-color: #999;
|
|
24
24
|
border-left-color: #999;
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
h1 {
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
35
|
font-size: 100%;
|
|
36
36
|
color: #730E15;
|
|
37
37
|
line-height: 1.5em;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
div.dialog > p {
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
41
|
margin: 0 0 1em;
|
|
42
42
|
padding: 1em;
|
|
43
43
|
background-color: #F7F7F7;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
</style>
|
|
55
55
|
</head>
|
|
56
56
|
|
|
57
|
-
<body>
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
58
|
<!-- This file lives in public/500.html -->
|
|
59
59
|
<div class="dialog">
|
|
60
60
|
<div>
|
|
File without changes
|
|
File without changes
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/33/33EUCQBNqL6TOaGyMFn9wz2v39pHMJ4LOUUFUteIHHM.cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"%��B�����șo�$'�A�d��L���xR�U
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/3N/3NnKgR2TsTI1qCXKZpts0uJzp2dRJcoYp3nnFU6YE4o.cache
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
[o:Set:
|
|
2
|
+
@hash}I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTF
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/7Q/7Q2gtOOyCVPFrfYz4KjmXJsM_m8Yra4MjgsQmfVGxZY.cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&id=b0fc51269f5a30cd9d7d2eedaad00ca3df5f3c117965a2f3e4dc5902767532ae:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/8c/8cROjTzeZZQaOFNLPKGuMtXO7EHxNfiEa72qt65UoF4.cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=d35a2de9bf475b03ab7c4109821448721454a5376d5a023c0c01d2c156a01760:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/F6/F6RhC2MbCvVanNZZe44hqlJNKAdIrH4NUzRxj5N2_EQ.cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=fc04be093b27339a8b66356c446578808c939a7d55357ab837918a04b2f5f07b:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/Fc/FcMeZRcfG4LrhIhl3xrAg3EhSZInU4efHmUrjIs4keE.cache
ADDED
|
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/H3/H3dfPRbxbWIB6dQXrQ6xA9nDJqy4dOq1ujslocGVY9U.cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"}app/assets/stylesheets/application.css?type=text/css&id=32f91865827ed99aeefdca6c631796f5dc304dc1e3adacca5062889824f3f995:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/LK/LKisVDbQmzgRQKdFoNH5tRbTr72CrlM_2q7MZczv2Pg.cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=c7508cd7ef462d9c3c1994cd6328c02584cb77120fa393b5a5cc627b2aab2e35:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/Pc/Pce9HMZhc6XmsNfLUN84Enw7mySJ7ZYzys9mXmCVXqA.cache
ADDED
|
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/Po/PoftKmjB8lzW06EMKeru1CsqVtULc0MsiTysT2JNqvU.cache
ADDED
|
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/Su/SuILTE3Es0N_r-36Ddu2E6h49WcwH_-RsZyG4SPwKFQ.cache
ADDED
|
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/cJ/cJG59MHf0x4qJKYES0pa0nLpOFpFF7YwrrvIVKIixyA.cache
ADDED
|
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/fw/fwPYklzExHPpgeuv53ew_8OIpJVRyaHj2Jtj2JP9j5A.cache
ADDED
|
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/jc/jc_TR7ZZTSFDDRKdgc-KnZskUESr2rLOqcYZej83LvU.cache
ADDED
|
Binary file
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/rV/rVy4-idUuK0Va9FLw3G8pYeZFwJAwmvs_bQcbq6_Cd0.cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"%��B�����șo�$'�A�d��L���xR�U
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/rY/rYyeRvy3oIuNfWeDhoriNlAlVjN4Wg4A3_9_OTDFin4.cache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"}app/assets/stylesheets/application.css?type=text/css&id=01e7326e301a8b006acc71de68fe1d6ba23fe6b3fbf3b69934201f1513015163:ET
|
data/test/dummy/tmp/cache/assets/sprockets/v3.0/tY/tYFbDrMNElXwgmisit50aNXJvRU2zlIFk5g-EJ1CQTc.cache
ADDED
|
Binary file
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_helper'
|
|
2
4
|
|
|
3
5
|
module Booties
|
|
4
6
|
class BadgeHelperTest < ActionView::TestCase
|
|
5
|
-
|
|
7
|
+
def test_badge_renders_span_tag_with_badge_class
|
|
6
8
|
expected = '<span class="badge">content</span>'
|
|
7
9
|
assert_equal expected, badge('content')
|
|
8
10
|
end
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
def test_badge_passes_miscellaneous_options_through_to_content_tag
|
|
11
13
|
expected = '<span class="badge" id="foo">content</span>'
|
|
12
14
|
assert_equal expected, badge('content', id: 'foo')
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
def test_badge_merges_optional_classes_with_badge_class
|
|
16
18
|
expected = '<span class="badge foo">content</span>'
|
|
17
19
|
assert_equal expected, badge('content', class: 'foo')
|
|
18
20
|
end
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
def test_badge_accepts_content_as_a_block
|
|
21
23
|
expected = '<span class="badge" id="foo">Bar</span>'
|
|
22
24
|
assert_equal expected, badge(id: 'foo') { 'Bar' }
|
|
23
25
|
end
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
def test_badge_handles_nil_content_when_no_block_is_given
|
|
26
28
|
expected = '<span class="badge"></span>'
|
|
27
29
|
assert_equal expected, badge(nil)
|
|
28
30
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_helper'
|
|
4
|
+
|
|
5
|
+
module Booties
|
|
6
|
+
class BreadcrumbHelperTest < ActionView::TestCase
|
|
7
|
+
def test_breadcrumbs_renders_ol_tag_with_breadcrumb_class
|
|
8
|
+
expected = '<ol class="breadcrumb"><li class="active">Hi</li></ol>'
|
|
9
|
+
actual = render_breadcrumbs { '<li class="active">Hi</li>'.html_safe }
|
|
10
|
+
assert_dom_equal expected, actual
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_helper'
|
|
2
4
|
|
|
3
5
|
module Booties
|
|
4
6
|
class ButtonHelperTest < ActionView::TestCase
|
|
5
|
-
|
|
6
|
-
expected =
|
|
7
|
-
|
|
7
|
+
def test_btn_link_to_renders_link_with_btn_classes
|
|
8
|
+
expected = '<a href="/foo" class="btn btn-default">Foo</a>'
|
|
9
|
+
assert_dom_equal expected, btn_link_to('Foo', '/foo')
|
|
8
10
|
end
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
expected =
|
|
12
|
-
|
|
12
|
+
def test_btn_link_to_context_can_be_overridden
|
|
13
|
+
expected = '<a href="/foo" class="btn btn-primary">Foo</a>'
|
|
14
|
+
assert_dom_equal expected, btn_link_to('Foo', '/foo', context: :primary)
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
expected =
|
|
17
|
-
|
|
17
|
+
def test_btn_link_to_passes_extra_as_html_options_to_link_to
|
|
18
|
+
expected = '<a href="/foo" class="btn btn-default btn-xs" data-method="delete" rel="nofollow">Foo</a>'
|
|
19
|
+
assert_dom_equal expected, btn_link_to('Foo', '/foo', class: 'btn-xs', method: :delete)
|
|
18
20
|
end
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
expected =
|
|
22
|
-
|
|
22
|
+
def test_btn_link_to_with_a_block
|
|
23
|
+
expected = '<a href="/foo" class="btn btn-default btn-xs">Foo</a>'
|
|
24
|
+
assert_dom_equal expected, btn_link_to('/foo', class: 'btn-xs') { 'Foo' }
|
|
23
25
|
end
|
|
24
26
|
end
|
|
25
27
|
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_helper'
|
|
4
|
+
|
|
5
|
+
module Booties
|
|
6
|
+
class DropdownHelperTest < ActionView::TestCase
|
|
7
|
+
def test_link_to_dropdown_renders_link_with_dropdown_options
|
|
8
|
+
expected = '<a class="dropdown-toggle" data-toggle="dropdown" role="button" href="#">Foo<span class="caret"></span></a>'
|
|
9
|
+
actual = link_to_dropdown { 'Foo' }
|
|
10
|
+
assert_dom_equal expected, actual
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_link_to_dropdown_with_custom_class
|
|
14
|
+
expected = '<a class="foo dropdown-toggle" data-toggle="dropdown" role="button" href="#">Foo<span class="caret"></span></a>'
|
|
15
|
+
actual = link_to_dropdown(class: 'foo') { 'Foo' }
|
|
16
|
+
assert_dom_equal expected, actual
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_button_to_dropdown_renders_button_with_dropdown_options
|
|
20
|
+
expected = '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Foo<span class="caret"></span></button>'
|
|
21
|
+
actual = button_to_dropdown { 'Foo' }
|
|
22
|
+
assert_dom_equal expected, actual
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_button_to_dropdown_with_context
|
|
26
|
+
expected = '<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Foo<span class="caret"></span></button>'
|
|
27
|
+
actual = button_to_dropdown(context: :primary) { 'Foo' }
|
|
28
|
+
assert_dom_equal expected, actual
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def test_button_to_dropdown_with_optional_classes
|
|
32
|
+
expected = '<button type="button" class="btn-xs btn btn-default dropdown-toggle" data-toggle="dropdown">Foo<span class="caret"></span></button>'
|
|
33
|
+
actual = button_to_dropdown(class: 'btn-xs') { 'Foo' }
|
|
34
|
+
assert_dom_equal expected, actual
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_dropdown_menu_renders_dropdown_list
|
|
38
|
+
expected = '<ul class="dropdown-menu"><li><a href="#">Foo</a></li></ul>'
|
|
39
|
+
actual = dropdown_menu { content_tag :li, link_to('Foo', '#') }
|
|
40
|
+
assert_dom_equal expected, actual
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_helper'
|
|
2
4
|
|
|
3
5
|
module Booties
|
|
4
6
|
class FlagHelperTest < ActionView::TestCase
|
|
5
|
-
|
|
7
|
+
def test_flag_renders_span_tag_with_label_classes
|
|
6
8
|
expected = '<span class="label label-default">content</span>'
|
|
7
9
|
assert_equal expected, flag('content')
|
|
8
10
|
end
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
def test_flag_accepts_a_custom_context
|
|
11
13
|
expected = '<span class="label label-primary">content</span>'
|
|
12
14
|
assert_equal expected, flag('content', context: :primary)
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
def test_flag_passes_miscellaneous_options_through_to_content_tag
|
|
16
18
|
expected = '<span class="label label-default" id="foo">content</span>'
|
|
17
19
|
assert_equal expected, flag('content', id: 'foo')
|
|
18
20
|
end
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
def test_flag_accepts_content_as_a_block
|
|
21
23
|
expected = '<span class="label label-default" id="foo">content</span>'
|
|
22
24
|
assert_equal expected, flag(id: 'foo') { 'content' }
|
|
23
25
|
end
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
def test_flag_merges_optional_classes_with_label_classes
|
|
26
28
|
expected = '<span class="label label-default foo">content</span>'
|
|
27
29
|
assert_equal expected, flag('content', class: 'foo')
|
|
28
30
|
end
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_helper'
|
|
2
4
|
require 'minitest/mock'
|
|
3
5
|
|
|
4
6
|
module Booties
|
|
5
7
|
class ModalHelperTest < ActionView::TestCase
|
|
6
|
-
|
|
8
|
+
def test_modal_instantiates_a_new_modal_and_calls_render
|
|
7
9
|
modal_class = Minitest::Mock.new
|
|
8
10
|
modal_instance = Minitest::Mock.new
|
|
9
11
|
|
|
10
12
|
modal_class.expect :new, modal_instance,
|
|
11
|
-
|
|
13
|
+
[self, id: 'foo', fade: true, size: nil]
|
|
12
14
|
modal_instance.expect :render, true, [{}]
|
|
13
15
|
|
|
14
16
|
modal 'foo', with: modal_class
|
|
@@ -17,12 +19,12 @@ module Booties
|
|
|
17
19
|
modal_instance.verify
|
|
18
20
|
end
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
def test_modal_passes_keyword_arguments_on_to_modal_constructor
|
|
21
23
|
modal_class = Minitest::Mock.new
|
|
22
24
|
modal_instance = Minitest::Mock.new
|
|
23
25
|
|
|
24
26
|
modal_class.expect :new, modal_instance,
|
|
25
|
-
|
|
27
|
+
[self, id: 'foo', fade: false, size: :large]
|
|
26
28
|
modal_instance.expect :render, true, [{}]
|
|
27
29
|
|
|
28
30
|
modal 'foo', fade: false, size: :large, with: modal_class
|
|
@@ -31,14 +33,14 @@ module Booties
|
|
|
31
33
|
modal_instance.verify
|
|
32
34
|
end
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
def test_modal_passes_optional_arguments_on_to_modal_render
|
|
35
37
|
modal_class = Minitest::Mock.new
|
|
36
38
|
modal_instance = Minitest::Mock.new
|
|
37
39
|
|
|
38
40
|
modal_class.expect :new, modal_instance,
|
|
39
|
-
|
|
41
|
+
[self, id: 'foo', fade: true, size: nil]
|
|
40
42
|
modal_instance.expect :render, true,
|
|
41
|
-
|
|
43
|
+
[{ class: 'foo', data: { bar: 'baz' } }]
|
|
42
44
|
|
|
43
45
|
modal 'foo', with: modal_class, class: 'foo', data: { bar: 'baz' }
|
|
44
46
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_helper'
|
|
2
4
|
require 'minitest/mock'
|
|
3
5
|
|
|
4
6
|
module Booties
|
|
5
7
|
class PanelHelperTest < ActionView::TestCase
|
|
6
|
-
|
|
8
|
+
def test_panel_instantiates_a_new_panel_and_calls_render
|
|
7
9
|
panel_class = Minitest::Mock.new
|
|
8
10
|
panel_instance = Minitest::Mock.new
|
|
9
11
|
|
|
@@ -16,7 +18,7 @@ module Booties
|
|
|
16
18
|
panel_instance.verify
|
|
17
19
|
end
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
def test_panel_instantiates_a_new_panel_with_the_given_context
|
|
20
22
|
panel_class = Minitest::Mock.new
|
|
21
23
|
panel_instance = Minitest::Mock.new
|
|
22
24
|
|
|
@@ -7,17 +7,15 @@ module Booties
|
|
|
7
7
|
CONTENT = 'Lorem ipsum dolor sin amet'
|
|
8
8
|
|
|
9
9
|
def test_popover_with_string
|
|
10
|
-
expected =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
assert_equal expected, popover('Link text', content: CONTENT)
|
|
10
|
+
expected = '<a role="button" data-toggle="popover" data-content="Lorem ipsum">Link text</a>'
|
|
11
|
+
actual = popover('Link text', content: 'Lorem ipsum')
|
|
12
|
+
assert_dom_equal expected, actual
|
|
14
13
|
end
|
|
15
14
|
|
|
16
15
|
def test_popover_with_block
|
|
17
|
-
expected =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
assert_equal expected, popover(content: CONTENT) { 'Link text' }
|
|
16
|
+
expected = '<a role="button" data-toggle="popover" data-content="Lorem ipsum">Link text</a>'
|
|
17
|
+
actual = popover(content: 'Lorem ipsum') { 'Link text' }
|
|
18
|
+
assert_equal expected, actual
|
|
21
19
|
end
|
|
22
20
|
|
|
23
21
|
def test_popover_requires_content_argument
|
|
@@ -26,53 +24,46 @@ module Booties
|
|
|
26
24
|
end
|
|
27
25
|
|
|
28
26
|
def test_popover_with_title
|
|
29
|
-
expected =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
title: 'Lorem ipsum'
|
|
33
|
-
assert_equal expected,
|
|
34
|
-
popover('Link text', content: CONTENT, title: 'Lorem ipsum')
|
|
27
|
+
expected = '<a role="button" title="Lorem ipsum" data-toggle="popover" data-content="Lorem ipsum dolor sin amet">Link text</a>'
|
|
28
|
+
actual = popover('Link text', content: 'Lorem ipsum dolor sin amet', title: 'Lorem ipsum')
|
|
29
|
+
assert_dom_equal expected, actual
|
|
35
30
|
end
|
|
36
31
|
|
|
37
32
|
def test_popover_with_placement
|
|
38
|
-
expected =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
assert_equal expected,
|
|
42
|
-
popover('Link text', content: CONTENT, placement: :top)
|
|
33
|
+
expected = '<a role="button" data-toggle="popover" data-content="Lorem ipsum" data-placement="top">Link text</a>'
|
|
34
|
+
actual = popover('Link text', content: 'Lorem ipsum', placement: :top)
|
|
35
|
+
assert_equal expected, actual
|
|
43
36
|
end
|
|
44
37
|
|
|
45
|
-
def
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
assert_equal 'invalid placement: :bogus, ' \
|
|
50
|
-
'valid placements are :left, :right, :top, :bottom', e.message
|
|
38
|
+
def test_popover_with_trigger
|
|
39
|
+
expected = '<a tabindex="10" role="button" data-toggle="popover" data-content="Lorem ipsum" data-trigger="focus">Link text</a>'
|
|
40
|
+
actual = popover('Link text', content: 'Lorem ipsum', trigger: :focus)
|
|
41
|
+
assert_dom_equal expected, actual
|
|
51
42
|
end
|
|
52
43
|
|
|
53
|
-
def
|
|
54
|
-
expected =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
def test_popover_with_container
|
|
45
|
+
expected = '<a role="button" data-toggle="popover"' \
|
|
46
|
+
' data-content="Lorem ipsum" data-container="body">Link text</a>'
|
|
47
|
+
actual = popover('Link text', content: 'Lorem ipsum', container: 'body')
|
|
48
|
+
assert_dom_equal expected, actual
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_popover_with_custom_tabindex
|
|
52
|
+
expected = '<a tabindex="42" role="button" data-toggle="popover" data-content="Lorem ipsum" data-trigger="focus">Link text</a>'
|
|
53
|
+
actual = popover('Link text', content: 'Lorem ipsum', trigger: :focus, tabindex: 42)
|
|
54
|
+
assert_dom_equal expected, actual
|
|
59
55
|
end
|
|
60
56
|
|
|
61
57
|
def test_popover_with_tag
|
|
62
|
-
expected =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
assert_equal expected,
|
|
66
|
-
popover('Link text', content: CONTENT, tag: :button)
|
|
58
|
+
expected = '<button type="button" data-toggle="popover" data-content="Lorem ipsum">Link text</button>'
|
|
59
|
+
actual = popover('Link text', content: 'Lorem ipsum', tag: :button)
|
|
60
|
+
assert_dom_equal expected, actual
|
|
67
61
|
end
|
|
68
62
|
|
|
69
63
|
def test_popover_passes_other_options_through_to_content_tag
|
|
70
|
-
expected =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
role: 'button'
|
|
74
|
-
assert_equal expected,
|
|
75
|
-
popover('Link text', content: CONTENT, class: 'btn btn-default', data: { foo: 'bar' })
|
|
64
|
+
expected = '<a class="btn btn-default" data-foo="bar" data-toggle="popover" data-content="Lorem ipsum" role="button">Link text</a>'
|
|
65
|
+
actual = popover('Link text', content: 'Lorem ipsum', class: 'btn btn-default', data: { foo: 'bar' })
|
|
66
|
+
assert_dom_equal expected, actual
|
|
76
67
|
end
|
|
77
68
|
end
|
|
78
69
|
end
|