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
d3721c50
Commit
d3721c50
authored
Mar 08, 2012
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.0.2-wip' of github.com:twitter/bootstrap into 2.0.2-wip
parents
bcef12df
26e683f1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
js/bootstrap-typeahead.js
js/bootstrap-typeahead.js
+6
-6
js/tests/unit/bootstrap-typeahead.js
js/tests/unit/bootstrap-typeahead.js
+5
-1
No files found.
js/bootstrap-typeahead.js
View file @
d3721c50
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
,
select
:
function
()
{
,
select
:
function
()
{
var
val
=
this
.
$menu
.
find
(
'
.active
'
).
attr
(
'
data-value
'
)
var
val
=
this
.
$menu
.
find
(
'
.active
'
).
attr
(
'
data-value
'
)
this
.
$element
.
val
(
val
)
this
.
$element
.
val
(
val
)
this
.
$element
.
change
();
return
this
.
hide
()
return
this
.
hide
()
}
}
...
@@ -165,9 +166,6 @@
...
@@ -165,9 +166,6 @@
}
}
,
keyup
:
function
(
e
)
{
,
keyup
:
function
(
e
)
{
e
.
stopPropagation
()
e
.
preventDefault
()
switch
(
e
.
keyCode
)
{
switch
(
e
.
keyCode
)
{
case
40
:
// down arrow
case
40
:
// down arrow
case
38
:
// up arrow
case
38
:
// up arrow
...
@@ -180,6 +178,7 @@
...
@@ -180,6 +178,7 @@
break
break
case
27
:
// escape
case
27
:
// escape
if
(
!
this
.
shown
)
return
this
.
hide
()
this
.
hide
()
break
break
...
@@ -187,10 +186,11 @@
...
@@ -187,10 +186,11 @@
this
.
lookup
()
this
.
lookup
()
}
}
e
.
stopPropagation
()
e
.
preventDefault
()
}
}
,
keypress
:
function
(
e
)
{
,
keypress
:
function
(
e
)
{
e
.
stopPropagation
()
if
(
!
this
.
shown
)
return
if
(
!
this
.
shown
)
return
switch
(
e
.
keyCode
)
{
switch
(
e
.
keyCode
)
{
...
@@ -210,12 +210,12 @@
...
@@ -210,12 +210,12 @@
this
.
next
()
this
.
next
()
break
break
}
}
e
.
stopPropagation
()
}
}
,
blur
:
function
(
e
)
{
,
blur
:
function
(
e
)
{
var
that
=
this
var
that
=
this
e
.
stopPropagation
()
e
.
preventDefault
()
setTimeout
(
function
()
{
that
.
hide
()
},
150
)
setTimeout
(
function
()
{
that
.
hide
()
},
150
)
}
}
...
...
js/tests/unit/bootstrap-typeahead.js
View file @
d3721c50
...
@@ -114,14 +114,18 @@ $(function () {
...
@@ -114,14 +114,18 @@ $(function () {
source
:
[
'
aa
'
,
'
ab
'
,
'
ac
'
]
source
:
[
'
aa
'
,
'
ab
'
,
'
ac
'
]
})
})
,
typeahead
=
$input
.
data
(
'
typeahead
'
)
,
typeahead
=
$input
.
data
(
'
typeahead
'
)
,
changed
=
false
$input
.
val
(
'
a
'
)
$input
.
val
(
'
a
'
)
typeahead
.
lookup
()
typeahead
.
lookup
()
$input
.
change
(
function
()
{
changed
=
true
});
$
(
typeahead
.
$menu
.
find
(
'
li
'
)[
2
]).
mouseover
().
click
()
$
(
typeahead
.
$menu
.
find
(
'
li
'
)[
2
]).
mouseover
().
click
()
equals
(
$input
.
val
(),
'
ac
'
,
'
input value was correctly set
'
)
equals
(
$input
.
val
(),
'
ac
'
,
'
input value was correctly set
'
)
ok
(
!
typeahead
.
$menu
.
is
(
'
:visible
'
),
'
the menu was hidden
'
)
ok
(
!
typeahead
.
$menu
.
is
(
'
:visible
'
),
'
the menu was hidden
'
)
ok
(
changed
,
'
a change event was fired
'
)
typeahead
.
$menu
.
remove
()
typeahead
.
$menu
.
remove
()
})
})
...
...
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