Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
eab9da5b
Commit
eab9da5b
authored
6 years ago
by
Johann-S
Browse files
Options
Download
Email Patches
Plain Diff
fix(util): use querySelector for ids
parent
6b92321f
2 merge requests
!28721
Hot test
,
!27561
Adds font-weight-medium to font weight classes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/src/util.js
+1
-1
js/src/util.js
js/tests/unit/util.js
+13
-0
js/tests/unit/util.js
with
14 additions
and
1 deletion
+14
-1
js/src/util.js
+
1
-
1
View file @
eab9da5b
...
@@ -84,7 +84,7 @@ const Util = (($) => {
...
@@ -84,7 +84,7 @@ const Util = (($) => {
}
}
const
validSelector
=
selector
const
validSelector
=
selector
if
(
selector
.
charAt
(
0
)
===
'
#
'
)
{
if
(
selector
.
charAt
(
0
)
===
'
#
'
&&
selector
.
indexOf
(
'
,
'
)
===
-
1
)
{
selector
=
selector
.
substr
(
1
)
selector
=
selector
.
substr
(
1
)
method
=
'
getElementById
'
method
=
'
getElementById
'
}
}
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/util.js
+
13
-
0
View file @
eab9da5b
...
@@ -32,6 +32,19 @@ $(function () {
...
@@ -32,6 +32,19 @@ $(function () {
assert
.
ok
(
spy
.
called
)
assert
.
ok
(
spy
.
called
)
})
})
QUnit
.
test
(
'
Util.getSelectorFromElement should use querySelector when there are multi ids
'
,
function
(
assert
)
{
assert
.
expect
(
2
)
var
spy
=
sinon
.
spy
(
document
,
'
querySelector
'
)
var
$el
=
$
(
'
<div data-target="#j7, #j8"></div>
'
).
appendTo
(
$
(
'
#qunit-fixture
'
))
$
(
'
<div id="j7" />
'
).
appendTo
(
$
(
'
#qunit-fixture
'
))
$
(
'
<div id="j8" />
'
).
appendTo
(
$
(
'
#qunit-fixture
'
))
assert
.
strictEqual
(
Util
.
getSelectorFromElement
(
$el
[
0
]),
'
#j7, #j8
'
)
assert
.
ok
(
spy
.
called
)
})
QUnit
.
test
(
'
Util.typeCheckConfig should thrown an error when a bad config is passed
'
,
function
(
assert
)
{
QUnit
.
test
(
'
Util.typeCheckConfig should thrown an error when a bad config is passed
'
,
function
(
assert
)
{
assert
.
expect
(
1
)
assert
.
expect
(
1
)
var
namePlugin
=
'
collapse
'
var
namePlugin
=
'
collapse
'
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets