Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function open (hook = 'select') {
// In a real browser when you click on the select with your mouse a
// focusin event is fired on the component. However when using jQuery's
// click() method the focusin is not fired so we are programitcally
// triggering that in this test.
$hook(hook).click().trigger('focusin')
return wait()
}
destItemIdx = items.indexOf(destItem) + 1;
items.insertAt(destItemIdx, sourceItem);
} else {
// native array
destItem = items[destItemIdx];
sourceItem = items[sourceItemIdx];
items.splice(sourceItemIdx, 1);
destItemIdx = items.indexOf(destItem) + 1;
items.splice(destItemIdx, 0, sourceItem);
// if we are not using Ember Arrays we need to set `items` to a new array
// instance to trigger a recompute on `virtualComponents`
context.set('items', [].concat(items));
}
});
return wait();
}
export default function() {
return wait().then(() => {
return new EmberPromise((resolve) => {
// Two RAFs needed since we take 3 frames to do the initial render
requestAnimationFrame(() => requestAnimationFrame((resolve)));
});
});
}
export function flushScrollAndWait() {
return wait().then(() => {
return new Ember.RSVP.Promise((resolve) => {
window.requestAnimationFrame(resolve);
});
});
}
export default function(app) {
let ctx = { app };
Test.registerWaiter(ctx, hasNoIframe);
return wait().then(() => {
Test.unregisterWaiter(ctx, hasNoIframe);
return RSVP.resolve();
}).then(() => {
return new RSVP.Promise(function (resolve) {
run.later(resolve, 10);
});
});
}
async function testWait() {
await wait();
}
export function replaceArray(context, items) {
const oldItems = context.get('items');
run(() => {
if (EmberArray.detect(oldItems)) {
context.set('items', A(items));
} else {
context.set('items', items);
}
});
return wait();
}
export function append(context, itemsToAppend) {
const items = context.get('items');
run(() => {
if (items.pushObjects) {
items.pushObjects(itemsToAppend);
} else {
context.set('items', items.concat(itemsToAppend));
}
});
return wait();
}
const hookName = `${hook}-${bunsenId}`
const radioButtonHook = `${hookName}-radio-group-button-input`
const defaults = {
buttonNumber: 1
}
state = merge(defaults, state)
if (state.buttonNumber === 1) {
$hook(radioButtonHook).first().trigger('click')
} else {
$hook(radioButtonHook).last().trigger('click')
}
return wait()
}
export function close (hook = 'select') {
$hook(hook).click().trigger('focusout')
return wait()
}