DefinitelyTyped/types/semantic-ui-sticky/semantic-ui-sticky-tests.ts
Leonard Thieu 1abd6ee8d6 [semantic-ui] Update to 2.2.11 (#18431)
* [semantic-ui-form] Update to 2.2.11.

* [semantic-ui-form] Add previously undocumented 'add prompt' behavior.

* [semantic-ui-modal] Fix spacing in documentation.

* [semantic-ui-sticky] Update to 2.2.11.

* [semantic-ui-popup] Update to 2.2.11.

* [semantic-ui-api] Add 'api' setting.

* [semantic-ui-api] Lint.
2017-07-27 08:07:27 -07:00

82 lines
2.4 KiB
TypeScript

function test_sticky_static() {
$.fn.sticky.settings.error!.method = 'method';
$.fn.sticky.settings.namespace = 'namespace';
$.fn.sticky.settings.name = 'name';
$.fn.sticky.settings.silent = false;
$.fn.sticky.settings.debug = true;
$.fn.sticky.settings.performance = true;
$.fn.sticky.settings.verbose = true;
}
function test_sticky() {
const selector = '.ui.sticky';
$(selector).sticky('refresh'); // $ExpectType JQuery<HTMLElement>
$(selector).sticky('destroy'); // $ExpectType JQuery<HTMLElement>
$(selector).sticky('setting', 'debug', undefined); // $ExpectType boolean
$(selector).sticky('setting', 'debug'); // $ExpectType boolean
$(selector).sticky('setting', 'debug', true); // $ExpectType JQuery<HTMLElement>
// $ExpectType JQuery<HTMLElement>
$(selector).sticky('setting', {
namespace: 'namespace',
name: 'name',
silent: false,
debug: true,
performance: true,
verbose: true
});
// $ExpectType JQuery<HTMLElement>
$(selector).sticky({
pushing: false,
setSize: false,
jitter: 4,
observeChanges: true,
context: $(),
scrollContext: $(),
offset: 1,
bottomOffset: 200,
onReposition() {
this; // $ExpectType JQuery<HTMLElement>
},
onScroll() {
this; // $ExpectType JQuery<HTMLElement>
},
onStick() {
this; // $ExpectType JQuery<HTMLElement>
},
onUnstick() {
this; // $ExpectType JQuery<HTMLElement>
},
onTop() {
this; // $ExpectType JQuery<HTMLElement>
},
onBottom() {
this; // $ExpectType JQuery<HTMLElement>
},
className: {
bound: 'bound',
fixed: 'fixed',
supported: 'supported',
top: 'top',
bottom: 'bottom'
},
error: {
container: 'container',
visible: 'visible',
method: 'method',
invalidContext: 'invalidContext',
elementSize: 'elementSize'
}
});
$(selector).sticky(); // $ExpectType JQuery<HTMLElement>
$(selector).sticky('foo'); // $ExpectError
$(selector).sticky({ foo: 'bar' }); // $ExpectError
}
import sticky = require('semantic-ui-sticky');
function test_module() {
sticky; // $ExpectType Sticky
$.fn.sticky = sticky;
}