Files
test-repo/tests/flow/bom/MutationObserver.js
T
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00

30 lines
967 B
JavaScript

/* @flow */
// constructor
function callback(arr: Array<MutationRecord>, observer: MutationObserver): void {
return;
}
const o: MutationObserver = new MutationObserver(callback); // correct
new MutationObserver((arr: Array<MutationRecord>) => true); // correct
new MutationObserver(() => {}); // correct
new MutationObserver(); // incorrect
new MutationObserver(42); // incorrect
new MutationObserver((n: number) => {}); // incorrect
// observe
const div = document.createElement('div');
o.observe(div, { attributes: true, attributeFilter: ['style'] }); // correct
o.observe(div, { characterData: true, invalid: true }); // correct
o.observe(); // incorrect
o.observe('invalid'); // incorrect
o.observe(div); // incorrect
o.observe(div, {}); // incorrect
o.observe(div, { subtree: true }); // incorrect
o.observe(div, { attributes: true, attributeFilter: true }); // incorrect
// takeRecords
o.takeRecords(); // correct
// disconnect
o.disconnect(); // correct