Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
75bffd84
Commit
75bffd84
authored
Aug 04, 2014
by
Heinrich Fenkart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use closest `.alert` for alert dismissal; closes #14306
parent
14e8ec25
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
js/alert.js
js/alert.js
+1
-1
js/tests/unit/alert.js
js/tests/unit/alert.js
+4
-4
No files found.
js/alert.js
View file @
75bffd84
...
...
@@ -36,7 +36,7 @@
if
(
e
)
e
.
preventDefault
()
if
(
!
$parent
.
length
)
{
$parent
=
$this
.
hasClass
(
'
alert
'
)
?
$this
:
$this
.
parent
(
)
$parent
=
$this
.
closest
(
'
.alert
'
)
}
$parent
.
trigger
(
e
=
$
.
Event
(
'
close.bs.alert
'
))
...
...
js/tests/unit/alert.js
View file @
75bffd84
...
...
@@ -30,7 +30,7 @@ $(function () {
})
test
(
'
should fade element out on clicking .close
'
,
function
()
{
var
alertHTML
=
'
<div class="alert
-message warning
fade in">
'
var
alertHTML
=
'
<div class="alert
alert-danger
fade in">
'
+
'
<a class="close" href="#" data-dismiss="alert">×</a>
'
+
'
<p><strong>Holy guacamole!</strong> Best check yo self, you
\'
re not looking too good.</p>
'
+
'
</div>
'
...
...
@@ -42,17 +42,17 @@ $(function () {
})
test
(
'
should remove element when clicking .close
'
,
function
()
{
var
alertHTML
=
'
<div class="alert
-message warning
fade in">
'
var
alertHTML
=
'
<div class="alert
alert-danger
fade in">
'
+
'
<a class="close" href="#" data-dismiss="alert">×</a>
'
+
'
<p><strong>Holy guacamole!</strong> Best check yo self, you
\'
re not looking too good.</p>
'
+
'
</div>
'
var
$alert
=
$
(
alertHTML
).
appendTo
(
'
#qunit-fixture
'
).
bootstrapAlert
()
notEqual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert
-message
'
).
length
,
0
,
'
element added to dom
'
)
notEqual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert
'
).
length
,
0
,
'
element added to dom
'
)
$alert
.
find
(
'
.close
'
).
click
()
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert
-message
'
).
length
,
0
,
'
element removed from dom
'
)
equal
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert
'
).
length
,
0
,
'
element removed from dom
'
)
})
test
(
'
should not fire closed when close is prevented
'
,
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment