mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Changed interface Templates to support Handlebars templates as header, footer and empty.
This commit is contained in:
@@ -227,6 +227,17 @@ function test_dataset_templates() {
|
||||
});
|
||||
}
|
||||
|
||||
function with_empty_option_as_a_function() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: {
|
||||
empty: function(context: any) {
|
||||
return context.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function with_footer_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
@@ -234,6 +245,17 @@ function test_dataset_templates() {
|
||||
});
|
||||
}
|
||||
|
||||
function with_footer_option_as_a_function() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: {
|
||||
footer: function(context: any) {
|
||||
return context.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function with_header_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
@@ -241,6 +263,17 @@ function test_dataset_templates() {
|
||||
});
|
||||
}
|
||||
|
||||
function with_header_option_as_a_function() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: {
|
||||
header: function(context: any) {
|
||||
return context.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function with_suggestion_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
|
||||
Vendored
+3
-3
@@ -137,21 +137,21 @@ declare module Twitter.Typeahead {
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* If it's a precompiled template, the passed in context will contain query
|
||||
*/
|
||||
empty?: string;
|
||||
empty?: any;
|
||||
|
||||
/**
|
||||
* Rendered at the bottom of the dataset.
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* If it's a precompiled template, the passed in context will contain query and isEmpty.
|
||||
*/
|
||||
footer?: string;
|
||||
footer?: any;
|
||||
|
||||
/**
|
||||
* Rendered at the top of the dataset.
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* If it's a precompiled template, the passed in context will contain query and isEmpty.
|
||||
*/
|
||||
header?: string;
|
||||
header?: any;
|
||||
|
||||
/**
|
||||
* Used to render a single suggestion.
|
||||
|
||||
Reference in New Issue
Block a user