mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 06:50:19 +00:00
[semantic-ui-dropdown] Different weak-type workaround.
This commit is contained in:
+147
-26
@@ -157,19 +157,71 @@ declare namespace SemanticUI {
|
||||
*/
|
||||
(behavior: 'get placeholder text'): string;
|
||||
(behavior: 'destroy'): JQuery;
|
||||
<K extends keyof DropdownSettings>(behavior: 'setting', name: K, value?: undefined): DropdownSettings[K];
|
||||
<K extends keyof DropdownSettings>(behavior: 'setting', name: K, value: DropdownSettings[K]): JQuery;
|
||||
(behavior: 'setting', value: DropdownSettings.Param): JQuery;
|
||||
(settings?: DropdownSettings.Param): JQuery;
|
||||
<K extends keyof DropdownSettings>(behavior: 'setting', name: K, value?: undefined): DropdownSettings._Impl[K];
|
||||
<K extends keyof DropdownSettings>(behavior: 'setting', name: K, value: DropdownSettings._Impl[K]): JQuery;
|
||||
(behavior: 'setting', value: DropdownSettings): JQuery;
|
||||
(settings?: DropdownSettings): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link http://semantic-ui.com/modules/dropdown.html#/settings}
|
||||
*/
|
||||
interface DropdownSettings extends Pick<DropdownSettings._Impl, keyof DropdownSettings._Impl> { }
|
||||
type DropdownSettings = DropdownSettings.Param;
|
||||
|
||||
namespace DropdownSettings {
|
||||
type Param = DropdownSettings | object;
|
||||
type Param = (Pick<_Impl, 'on'> |
|
||||
Pick<_Impl, 'allowReselection'> |
|
||||
Pick<_Impl, 'allowAdditions'> |
|
||||
Pick<_Impl, 'hideAdditions'> |
|
||||
Pick<_Impl, 'action'> |
|
||||
Pick<_Impl, 'minCharacters'> |
|
||||
Pick<_Impl, 'match'> |
|
||||
Pick<_Impl, 'selectOnKeydown'> |
|
||||
Pick<_Impl, 'forceSelection'> |
|
||||
Pick<_Impl, 'allowCategorySelection'> |
|
||||
Pick<_Impl, 'placeholder'> |
|
||||
Pick<_Impl, 'apiSettings'> |
|
||||
Pick<_Impl, 'fields'> |
|
||||
Pick<_Impl, 'saveRemoteData'> |
|
||||
Pick<_Impl, 'filterRemoteData'> |
|
||||
Pick<_Impl, 'useLabels'> |
|
||||
Pick<_Impl, 'maxSelections'> |
|
||||
Pick<_Impl, 'glyphWidth'> |
|
||||
Pick<_Impl, 'label'> |
|
||||
Pick<_Impl, 'direction'> |
|
||||
Pick<_Impl, 'keepOnScreen'> |
|
||||
Pick<_Impl, 'context'> |
|
||||
Pick<_Impl, 'fullTextSearch'> |
|
||||
Pick<_Impl, 'preserveHTML'> |
|
||||
Pick<_Impl, 'sortSelect'> |
|
||||
Pick<_Impl, 'showOnFocus'> |
|
||||
Pick<_Impl, 'allowTab'> |
|
||||
Pick<_Impl, 'transition'> |
|
||||
Pick<_Impl, 'duration'> |
|
||||
Pick<_Impl, 'keys'> |
|
||||
Pick<_Impl, 'delay'> |
|
||||
Pick<_Impl, 'onChange'> |
|
||||
Pick<_Impl, 'onAdd'> |
|
||||
Pick<_Impl, 'onRemove'> |
|
||||
Pick<_Impl, 'onLabelCreate'> |
|
||||
Pick<_Impl, 'onLabelRemove'> |
|
||||
Pick<_Impl, 'onLabelSelect'> |
|
||||
Pick<_Impl, 'onNoResults'> |
|
||||
Pick<_Impl, 'onShow'> |
|
||||
Pick<_Impl, 'onHide'> |
|
||||
Pick<_Impl, 'message'> |
|
||||
Pick<_Impl, 'selector'> |
|
||||
Pick<_Impl, 'regExp'> |
|
||||
Pick<_Impl, 'metadata'> |
|
||||
Pick<_Impl, 'className'> |
|
||||
Pick<_Impl, 'error'> |
|
||||
Pick<_Impl, 'namespace'> |
|
||||
Pick<_Impl, 'name'> |
|
||||
Pick<_Impl, 'silent'> |
|
||||
Pick<_Impl, 'debug'> |
|
||||
Pick<_Impl, 'performance'> |
|
||||
Pick<_Impl, 'verbose'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
// region Frequently Used Settings
|
||||
@@ -475,10 +527,14 @@ declare namespace SemanticUI {
|
||||
}
|
||||
|
||||
namespace Dropdown {
|
||||
interface FieldsSettings extends Pick<FieldsSettings._Impl, keyof FieldsSettings._Impl> { }
|
||||
type FieldsSettings = FieldsSettings.Param;
|
||||
|
||||
namespace FieldsSettings {
|
||||
type Param = FieldsSettings | object;
|
||||
type Param = (Pick<_Impl, 'remoteValues'> |
|
||||
Pick<_Impl, 'values'> |
|
||||
Pick<_Impl, 'name'> |
|
||||
Pick<_Impl, 'value'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -508,10 +564,13 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface LabelSettings extends Pick<LabelSettings._Impl, keyof LabelSettings._Impl> { }
|
||||
type LabelSettings = LabelSettings.Param;
|
||||
|
||||
namespace LabelSettings {
|
||||
type Param = LabelSettings | object;
|
||||
type Param = (Pick<_Impl, 'transition'> |
|
||||
Pick<_Impl, 'duration'> |
|
||||
Pick<_Impl, 'variation'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -529,10 +588,21 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface KeySettings extends Pick<KeySettings._Impl, keyof KeySettings._Impl> { }
|
||||
type KeySettings = KeySettings.Param;
|
||||
|
||||
namespace KeySettings {
|
||||
type Param = KeySettings | object;
|
||||
type Param = (Pick<_Impl, 'backspace'> |
|
||||
Pick<_Impl, 'delimiter'> |
|
||||
Pick<_Impl, 'deleteKey'> |
|
||||
Pick<_Impl, 'enter'> |
|
||||
Pick<_Impl, 'escape'> |
|
||||
Pick<_Impl, 'pageUp'> |
|
||||
Pick<_Impl, 'pageDown'> |
|
||||
Pick<_Impl, 'leftArrow'> |
|
||||
Pick<_Impl, 'upArrow'> |
|
||||
Pick<_Impl, 'rightArrow'> |
|
||||
Pick<_Impl, 'downArrow'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -582,10 +652,14 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface DelaySettings extends Pick<DelaySettings._Impl, keyof DelaySettings._Impl> { }
|
||||
type DelaySettings = DelaySettings.Param;
|
||||
|
||||
namespace DelaySettings {
|
||||
type Param = DelaySettings | object;
|
||||
type Param = (Pick<_Impl, 'hide'> |
|
||||
Pick<_Impl, 'show'> |
|
||||
Pick<_Impl, 'search'> |
|
||||
Pick<_Impl, 'touch'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -607,10 +681,14 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface MessageSettings extends Pick<MessageSettings._Impl, keyof MessageSettings._Impl> { }
|
||||
type MessageSettings = MessageSettings.Param;
|
||||
|
||||
namespace MessageSettings {
|
||||
type Param = MessageSettings | object;
|
||||
type Param = (Pick<_Impl, 'addResult'> |
|
||||
Pick<_Impl, 'count'> |
|
||||
Pick<_Impl, 'maxSelections'> |
|
||||
Pick<_Impl, 'noResults'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -632,10 +710,23 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface SelectorSettings extends Pick<SelectorSettings._Impl, keyof SelectorSettings._Impl> { }
|
||||
type SelectorSettings = SelectorSettings.Param;
|
||||
|
||||
namespace SelectorSettings {
|
||||
type Param = SelectorSettings | object;
|
||||
type Param = (Pick<_Impl, 'addition'> |
|
||||
Pick<_Impl, 'dropdown'> |
|
||||
Pick<_Impl, 'icon'> |
|
||||
Pick<_Impl, 'input'> |
|
||||
Pick<_Impl, 'item'> |
|
||||
Pick<_Impl, 'label'> |
|
||||
Pick<_Impl, 'remove'> |
|
||||
Pick<_Impl, 'siblingLabel'> |
|
||||
Pick<_Impl, 'menu'> |
|
||||
Pick<_Impl, 'message'> |
|
||||
Pick<_Impl, 'menuIcon'> |
|
||||
Pick<_Impl, 'search'> |
|
||||
Pick<_Impl, 'text'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -693,10 +784,11 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface RegExpSettings extends Pick<RegExpSettings._Impl, keyof RegExpSettings._Impl> { }
|
||||
type RegExpSettings = RegExpSettings.Param;
|
||||
|
||||
namespace RegExpSettings {
|
||||
type Param = RegExpSettings | object;
|
||||
type Param = (Pick<_Impl, 'escape'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -706,10 +798,15 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface MetadataSettings extends Pick<MetadataSettings._Impl, keyof MetadataSettings._Impl> { }
|
||||
type MetadataSettings = MetadataSettings.Param;
|
||||
|
||||
namespace MetadataSettings {
|
||||
type Param = MetadataSettings | object;
|
||||
type Param = (Pick<_Impl, 'defaultText'> |
|
||||
Pick<_Impl, 'defaultValue'> |
|
||||
Pick<_Impl, 'placeholderText'> |
|
||||
Pick<_Impl, 'text'> |
|
||||
Pick<_Impl, 'value'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -735,10 +832,29 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface ClassNameSettings extends Pick<ClassNameSettings._Impl, keyof ClassNameSettings._Impl> { }
|
||||
type ClassNameSettings = ClassNameSettings.Param;
|
||||
|
||||
namespace ClassNameSettings {
|
||||
type Param = ClassNameSettings | object;
|
||||
type Param = (Pick<_Impl, 'active'> |
|
||||
Pick<_Impl, 'addition'> |
|
||||
Pick<_Impl, 'animating'> |
|
||||
Pick<_Impl, 'disabled'> |
|
||||
Pick<_Impl, 'dropdown'> |
|
||||
Pick<_Impl, 'filtered'> |
|
||||
Pick<_Impl, 'hidden'> |
|
||||
Pick<_Impl, 'item'> |
|
||||
Pick<_Impl, 'label'> |
|
||||
Pick<_Impl, 'loading'> |
|
||||
Pick<_Impl, 'menu'> |
|
||||
Pick<_Impl, 'message'> |
|
||||
Pick<_Impl, 'multiple'> |
|
||||
Pick<_Impl, 'placeholder'> |
|
||||
Pick<_Impl, 'search'> |
|
||||
Pick<_Impl, 'selected'> |
|
||||
Pick<_Impl, 'selection'> |
|
||||
Pick<_Impl, 'upward'> |
|
||||
Pick<_Impl, 'visible'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
@@ -820,10 +936,15 @@ declare namespace SemanticUI {
|
||||
}
|
||||
}
|
||||
|
||||
interface ErrorSettings extends Pick<ErrorSettings._Impl, keyof ErrorSettings._Impl> { }
|
||||
type ErrorSettings = ErrorSettings.Param;
|
||||
|
||||
namespace ErrorSettings {
|
||||
type Param = ErrorSettings | object;
|
||||
type Param = (Pick<_Impl, 'action'> |
|
||||
Pick<_Impl, 'alreadySetup'> |
|
||||
Pick<_Impl, 'labels'> |
|
||||
Pick<_Impl, 'method'> |
|
||||
Pick<_Impl, 'noTransition'>) &
|
||||
Partial<Pick<_Impl, keyof _Impl>>;
|
||||
|
||||
interface _Impl {
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function test_dropdown_static() {
|
||||
$.fn.dropdown.settings.error.method = 'method';
|
||||
$.fn.dropdown.settings.error!.method = 'method';
|
||||
$.fn.dropdown.settings.namespace = 'namespace';
|
||||
$.fn.dropdown.settings.name = 'name';
|
||||
$.fn.dropdown.settings.silent = false;
|
||||
@@ -10,47 +10,48 @@ function test_dropdown_static() {
|
||||
|
||||
function test_dropdown() {
|
||||
const selector = '.ui.dropdown';
|
||||
$(selector).dropdown('setup menu') === $();
|
||||
$(selector).dropdown('refresh') === $();
|
||||
$(selector).dropdown('toggle') === $();
|
||||
$(selector).dropdown('show') === $();
|
||||
$(selector).dropdown('hide') === $();
|
||||
$(selector).dropdown('clear') === $();
|
||||
$(selector).dropdown('hide others') === $();
|
||||
$(selector).dropdown('restore defaults') === $();
|
||||
$(selector).dropdown('restore default text') === $();
|
||||
$(selector).dropdown('restore placeholder text') === $();
|
||||
$(selector).dropdown('restore default value') === $();
|
||||
$(selector).dropdown('save defaults') === $();
|
||||
$(selector).dropdown('set selected', 123) === $();
|
||||
$(selector).dropdown('remove selected', false) === $();
|
||||
$(selector).dropdown('set selected', ['456']) === $();
|
||||
$(selector).dropdown('set exactly', []) === $();
|
||||
$(selector).dropdown('set text', 'hello') === $();
|
||||
$(selector).dropdown('set value', 24) === $();
|
||||
$(selector).dropdown('get text') === 'text';
|
||||
$(selector).dropdown('get value') === {};
|
||||
$(selector).dropdown('get item', 'Pennsylvania') === $();
|
||||
$(selector).dropdown('bind touch events') === $();
|
||||
$(selector).dropdown('bind mouse events') === $();
|
||||
$(selector).dropdown('bind intent') === $();
|
||||
$(selector).dropdown('unbind intent') === $();
|
||||
$(selector).dropdown('determine intent') === true;
|
||||
$(selector).dropdown('determine select action', 'text', 90) === $();
|
||||
$(selector).dropdown('set active') === $();
|
||||
$(selector).dropdown('set visible') === $();
|
||||
$(selector).dropdown('remove active') === $();
|
||||
$(selector).dropdown('remove visible') === $();
|
||||
$(selector).dropdown('is selection') === false;
|
||||
$(selector).dropdown('is animated') === false;
|
||||
$(selector).dropdown('is visible') === false;
|
||||
$(selector).dropdown('is hidden') === false;
|
||||
$(selector).dropdown('setup menu'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('refresh'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('toggle'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('show'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('hide'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('clear'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('hide others'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('restore defaults'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('restore default text'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('restore placeholder text'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('restore default value'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('save defaults'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('set selected', 123); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('remove selected', false); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('set selected', ['456']); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('set exactly', []); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('set text', 'hello'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('set value', 24); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('get text'); // $ExpectType string
|
||||
$(selector).dropdown('get value'); // $ExpectType any
|
||||
$(selector).dropdown('get item', 'Pennsylvania'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('bind touch events'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('bind mouse events'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('bind intent'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('unbind intent'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('determine intent'); // $ExpectType boolean
|
||||
$(selector).dropdown('determine select action', 'text', 90); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('set active'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('set visible'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('remove active'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('remove visible'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('is selection'); // $ExpectType boolean
|
||||
$(selector).dropdown('is animated'); // $ExpectType boolean
|
||||
$(selector).dropdown('is visible'); // $ExpectType boolean
|
||||
$(selector).dropdown('is hidden'); // $ExpectType boolean
|
||||
$(selector).dropdown('get default text') === 'default text';
|
||||
$(selector).dropdown('get placeholder text') === 'placeholder text';
|
||||
$(selector).dropdown('destroy') === $();
|
||||
$(selector).dropdown('setting', 'debug', undefined) === false;
|
||||
$(selector).dropdown('setting', 'debug') === false;
|
||||
$(selector).dropdown('setting', 'debug', true) === $();
|
||||
$(selector).dropdown('destroy'); // $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('setting', 'debug', undefined); // $ExpectType boolean
|
||||
$(selector).dropdown('setting', 'debug'); // $ExpectType boolean
|
||||
$(selector).dropdown('setting', 'debug', true); // $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown('setting', {
|
||||
namespace: 'namespace',
|
||||
name: 'name',
|
||||
@@ -58,19 +59,18 @@ function test_dropdown() {
|
||||
debug: true,
|
||||
performance: true,
|
||||
verbose: true
|
||||
}) === $();
|
||||
});
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$(selector).dropdown({
|
||||
on: 'hover',
|
||||
allowReselection: true,
|
||||
allowAdditions: false,
|
||||
hideAdditions: true,
|
||||
action(text, value, element) {
|
||||
this === $();
|
||||
text === 'text';
|
||||
if (typeof value !== 'string') {
|
||||
value === false;
|
||||
}
|
||||
element === $();
|
||||
this; // $ExpectType JQuery<HTMLElement>
|
||||
text; // $ExpectType string
|
||||
value; // $ExpectType string | false
|
||||
element; // $ExpectType JQuery<HTMLElement>
|
||||
},
|
||||
minCharacters: 2,
|
||||
match: 'text',
|
||||
@@ -79,9 +79,107 @@ function test_dropdown() {
|
||||
allowCategorySelection: false,
|
||||
placeholder: 'value',
|
||||
apiSettings: {
|
||||
cache: 'local',
|
||||
on: 'on',
|
||||
cache: true,
|
||||
stateContext: $(),
|
||||
encodeParameters: false,
|
||||
defaultData: true,
|
||||
serializeForm: false,
|
||||
throttle: 10,
|
||||
throttleFirstRequest: true,
|
||||
loadingDuration: 20
|
||||
interruptRequests: false,
|
||||
loadingDuration: 3,
|
||||
hideError: true,
|
||||
errorDuration: 10,
|
||||
action: 'action',
|
||||
url: 'url',
|
||||
urlData: false,
|
||||
response: false,
|
||||
responseAsync(settings, callback) {
|
||||
settings; // $ExpectType Param
|
||||
callback; // $ExpectType (response: any) => void
|
||||
},
|
||||
mockResponse: false,
|
||||
mockResponseAsync(settings, callback) {
|
||||
settings; // $ExpectType Param
|
||||
callback; // $ExpectType (response: any) => void
|
||||
},
|
||||
method: 'post',
|
||||
dataType: 'xml',
|
||||
data: {},
|
||||
beforeSend(settings) {
|
||||
settings; // $ExpectType Param
|
||||
},
|
||||
beforeXHR(xhrObject) {
|
||||
xhrObject; // $ExpectType jqXHR<any>
|
||||
},
|
||||
onRequest(promise, xhr) {
|
||||
promise; // $ExpectType Deferred<any, any, any>
|
||||
xhr; // $ExpectType jqXHR<any>
|
||||
},
|
||||
onResponse(response) {
|
||||
response; // $ExpectType any
|
||||
},
|
||||
successTest(response) {
|
||||
response; // $ExpectType any
|
||||
|
||||
return false;
|
||||
},
|
||||
onSuccess(response, element, xhr) {
|
||||
response; // $ExpectType any
|
||||
element; // $ExpectType JQuery<HTMLElement>
|
||||
xhr; // $ExpectType jqXHR<any>
|
||||
},
|
||||
onComplete(response, element, xhr) {
|
||||
response; // $ExpectType any
|
||||
element; // $ExpectType JQuery<HTMLElement>
|
||||
xhr; // $ExpectType jqXHR<any>
|
||||
},
|
||||
onFailure(response, element) {
|
||||
response; // $ExpectType any
|
||||
element; // $ExpectType JQuery<HTMLElement>
|
||||
},
|
||||
onError(errorMessage, element, xhr) {
|
||||
errorMessage; // $ExpectType string
|
||||
element; // $ExpectType JQuery<HTMLElement>
|
||||
xhr; // $ExpectType jqXHR<any>
|
||||
},
|
||||
onAbort(errorMessage, element, xhr) {
|
||||
errorMessage; // $ExpectType string
|
||||
element; // $ExpectType JQuery<HTMLElement>
|
||||
xhr; // $ExpectType jqXHR<any>
|
||||
},
|
||||
regExp: {
|
||||
required: /{\$*[A-z0-9]+}/g,
|
||||
optional: /{\/\$*[A-z0-9]+}/g
|
||||
},
|
||||
selector: {
|
||||
disabled: '.disabled',
|
||||
form: 'form'
|
||||
},
|
||||
className: {
|
||||
loading: 'loading',
|
||||
error: 'error'
|
||||
},
|
||||
metadata: {
|
||||
action: 'action',
|
||||
url: 'url'
|
||||
},
|
||||
error: {
|
||||
beforeSend: 'beforeSend',
|
||||
error: 'error',
|
||||
exitConditions: 'exitConditions',
|
||||
JSONParse: 'JSONParse',
|
||||
legacyParameters: 'legacyParameters',
|
||||
missingAction: 'missingAction',
|
||||
missingSerialize: 'missingSerialize',
|
||||
missingURL: 'missingURL',
|
||||
noReturnedValue: 'noReturnedValue',
|
||||
parseError: 'parseError',
|
||||
requiredParameter: 'requiredParameter',
|
||||
statusMessage: 'statusMessage',
|
||||
timeout: 'timeout'
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
remoteValues: 'remoteValues',
|
||||
@@ -129,14 +227,14 @@ function test_dropdown() {
|
||||
touch: 50
|
||||
},
|
||||
onChange(value, text, $choice) {
|
||||
value === {};
|
||||
text === 'text';
|
||||
$choice === $();
|
||||
value; // $ExpectType any
|
||||
text; // $ExpectType string
|
||||
$choice; // $ExpectType JQuery<HTMLElement>
|
||||
},
|
||||
onAdd(addedValue, addedText, $addedChoice) {
|
||||
addedValue === {};
|
||||
addedText === 'addedText';
|
||||
$addedChoice === $();
|
||||
addedValue; // $ExpectType any
|
||||
addedText; // $ExpectType string
|
||||
$addedChoice; // $ExpectType JQuery<HTMLElement>
|
||||
},
|
||||
message: {
|
||||
addResult: 'addResult',
|
||||
@@ -197,12 +295,16 @@ function test_dropdown() {
|
||||
method: 'method',
|
||||
noTransition: 'noTransition'
|
||||
}
|
||||
}) === $();
|
||||
$(selector).dropdown() === $();
|
||||
});
|
||||
$(selector).dropdown(); // $ExpectType JQuery<HTMLElement>
|
||||
|
||||
$(selector).dropdown('foo'); // $ExpectError
|
||||
$(selector).dropdown({ foo: 'bar' }); // $ExpectError
|
||||
}
|
||||
|
||||
import dropdown = require('semantic-ui-dropdown');
|
||||
|
||||
function test_module() {
|
||||
dropdown; // $ExpectType Dropdown
|
||||
$.fn.dropdown = dropdown;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user