Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('click()', function() {
let spy = sinon.spy(function(e) {
// noop
});
let target = document.createElement('div');
click(target).subscribe(spy);
ClickEvent.simulate(target);
assert(spy.calledOnce);
ClickEvent.simulate(target);
assert(spy.calledTwice);
ClickEvent.simulate(target);
assert(spy.calledThrice);
});
it('should support keyCode up & down', () => {
const dataSource = [
{ label: 'xxx', value: 'a' },
{ label: 'empty', value: 'b' },
];
wrapper.setProps({
dataSource,
visible: true,
});
wrapper.find('input').simulate('keydown', { keyCode: 40 });
wrapper.find('input').simulate('keydown', { keyCode: 40 });
wrapper.update();
assert(
document.querySelectorAll('.next-menu-item.next-focused').length ===
1
);
wrapper.find('input').simulate('keydown', { keyCode: 13 });
wrapper.update();
assert(wrapper.find('input').prop('value') === 'b');
wrapper.find('input').simulate('keydown', { keyCode: 38 });
wrapper.find('input').simulate('keydown', { keyCode: 27 });
wrapper.find('input').simulate('keydown', { keyCode: 32 });
wrapper.find('input').simulate('keydown', { keyCode: 8 });
wrapper.find('input').simulate('keydown', { keyCode: 9 });
// wrapper.find('input').simulate('keydown', {keyCode: 38});
// wrapper.find('input').simulate('keydown', {keyCode: 13});
// assert(wrapper.find('input').prop('value') === 'a');
assert.throws(() => {
query.orderBy(Firestore.FieldPath.documentId())
.startAt(firestore.doc('coll/doc/other/doc'));
}, /'coll\/doc\/other\/doc' is not part of the query result set and cannot be used as a query boundary./);
assert.throws(() => {
query.orderBy(Firestore.FieldPath.documentId())
.startAt(firestore.doc('coll/doc/coll_suffix/doc'));
}, /'coll\/doc\/coll_suffix\/doc' is not part of the query result set and cannot be used as a query boundary./);
assert.throws(() => {
query.orderBy(Firestore.FieldPath.documentId())
.startAt(firestore.doc('coll/doc'));
}, /'coll\/doc' is not part of the query result set and cannot be used as a query boundary./);
assert.throws(() => {
query.orderBy(Firestore.FieldPath.documentId())
.startAt(firestore.doc('coll/doc/coll/doc/coll/doc'));
}, /Only a direct child can be used as a query boundary. Found: 'coll\/doc\/coll\/doc\/coll\/doc'./);
// Validate that we can't pass a reference to a collection.
assert.throws(() => {
query.orderBy(Firestore.FieldPath.documentId()).startAt('doc/coll');
}, /Only a direct child can be used as a query boundary. Found: 'coll\/doc\/coll\/doc\/coll'./);
});
pluginManager.pluginApi.event.file.beforeRender(beforeSpy);
pluginManager.pluginApi.event.file.afterRender(afterSpy);
try {
await instance.renderFileWithPlugins(
file,
{},
PluginEvents.file.beforeRender,
PluginEvents.file.afterRender
);
} catch (e) {
// noop
}
assert.equal(beforeSpy.callCount, 1);
assert.ok(beforeSpy.calledWith(file));
assert.equal(file.render.callCount, 1);
assert.ok(file.render.calledWith({}));
assert.equal(afterSpy.callCount, 1);
assert.ok(afterSpy.calledWith(file, renderContent));
});
});
error = e;
}
assert.ok(!error);
assert.equal(called, true);
called = false;
// The validator function above should now fail
shouldSucceed = false;
try {
yield m.validate();
} catch (e) {
error = e;
}
assert.ok(error);
assert.ok(error instanceof ValidationError);
done();
})();
});
.then(() => {
// Write data
const wizardData = {
a: 'a',
b: 'b'
};
Harness.testSubmission(form, {
data: wizardData
});
assert.deepStrictEqual(form._seenPages, [0]);
assert.equal(form.page, 0);
})
.then(() => {
var error;
var schema = new Schema({
description: {type: String, required: true}
});
var Breakfast = db.model('breakfast', schema, getCollectionName());
var goodBreakfast = new Breakfast({description: 'eggs & bacon'});
try {
yield goodBreakfast.save();
} catch (e) {
error = e;
}
assert.ifError(error);
var result;
try {
result = yield Breakfast.findOne().exec();
} catch (e) {
error = e;
}
assert.ifError(error);
assert.equal(result.description, 'eggs & bacon');
// Should cause a validation error because `description` is required
var badBreakfast = new Breakfast({});
try {
yield badBreakfast.save();
} catch (e) {
error = e;
}
const log = require('fliplog')
const power = require('power-assert')
const extend = require('lodash.assigninwith')
const exposeHidden = require('expose-hidden')
const {assert, should, assert2, should2} = require('./chai')
const {lcFirst, ucFirst} = require('./helpers')
const powers = require('./power')
const izz = require('./izz')
// https://github.com/avajs/ava/blob/2a206311d708361b294a21aa4c5bd199936d0824/lib/enhance-assert.js
let Fosho = {}
let debugMode = false
let logMode = false
// compatibility
power.true = power
// log if good to go
function gtg(key, args) {
if (!logMode) return
log
.color('green')
.text(key + '? fosho')
.echo()
}
// scope it so it doesn't need to be passed in every time
let scoped = null
// https://github.com/avajs/ava#assertions
const foshizzle = (arg, t) => {
if (!t && scoped) t = scoped
assert.equal(board.blocks[0], 3)
assert.equal(board.blocks[3], 0)
assert.equal(board.blankpos, 3)
board.swapRight(3)
assert.equal(board.blocks[3], 4)
assert.equal(board.blocks[4], 0)
assert.equal(board.blankpos, 4)
board.swapAbove(4)
assert.equal(board.blocks[4], 1)
assert.equal(board.blocks[1], 0)
assert.equal(board.blankpos, 1)
board.swapLeft(1)
assert.equal(board.blocks[1], 3)
assert.equal(board.blocks[0], 0)
assert.equal(board.blankpos, 0)
board.swapAbove(3)
assert.equal(board.blocks[3], 0)
assert.equal(board.blocks[0], 4)
assert.equal(board.blankpos, 3)
})
it('should throw error when no-empty block swapped', () => {
it('cannot listen without a window object', () => {
let router = Router()
assert.throws(() => router.start(), 'start should throw without a window')
assert.equal(router.isListening, false, 'isListening should still be false')
})
})