Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should let user scroll the page', () => {
// mock the internal setPosition function that moves the drawer while swiping
instance.setPosition = spy();
const handleOpen = spy();
const handleClose = spy();
wrapper.setProps({
open: false,
disableDiscovery: true,
onOpen: handleOpen,
onClose: handleClose,
});
fireBodyMouseEvent('touchstart', { touches: [params.ignoreTouch] });
assert.strictEqual(wrapper.state().maybeSwiping, false, 'should be listening for swipe');
assert.strictEqual(instance.setPosition.callCount, 0, 'should slide in');
fireBodyMouseEvent('touchend', { changedTouches: [params.ignoreTouch] });
assert.strictEqual(handleOpen.callCount, 0, 'should not call onOpen');
assert.strictEqual(handleClose.callCount, 0, 'should not call onClose');
});
});
it("should parse the handler as an attribute", () => {
const { body } = createJSDOM().window.document;
body.setAttribute("onhashchange", "document.body.onhashchangeRan = true;");
assert.strictEqual(body.getAttribute("onhashchange"), "document.body.onhashchangeRan = true;");
});
});
it("should return false if package.json does not exist", () => {
mockFs({});
assert.strictEqual(npmUtil.checkPackageJson(), false);
});
});
specify('should trim padString', function() {
assert.strictEqual(padStartInvoker('123456', 6, 'abc'), '123abc');
assert.strictEqual(padStartInvoker('123456', 5, 'abc'), '12abc');
});
}
assert.strictEqual(
p.getAttribute("xmlns:xlink"), "http://www.w3.org/1999/xlink",
"attributes should be retrievable by their full name"
);
const xmlnsAttr = p.attributes["xmlns:xlink"];
assert.strictEqual(xmlnsAttr.prefix, null, "attribute prefixes should be detected");
assert.strictEqual(xmlnsAttr.localName, "xmlns:xlink", "attribute localNames should be detected");
assert.strictEqual(
xmlnsAttr.namespaceURI, null,
"xmlns: attributes should not automatically be assigned to the xmlns namespace"
);
const img = document.getElementsByTagName("img")[0];
assert.strictEqual(img.prefix, null, "tag prefixes in html documents should always be null");
assert.strictEqual(img.localName, "img", "localNames in html documents always equal the tag name");
assert.strictEqual(
img.namespaceURI, "http://www.w3.org/1999/xhtml",
"html elements should automatically be assigned the XHTML namespace"
);
assert.strictEqual(
img.getAttribute("xlink:href"), "#test",
"attributes should be retrievable by their full name"
);
const xlinkAttr = img.attributes["xlink:href"];
assert.strictEqual(xlinkAttr.prefix, null, "attribute prefixes should be detected");
assert.strictEqual(xlinkAttr.localName, "xlink:href", "attribute localNames should be detected");
assert.strictEqual(
xlinkAttr.namespaceURI, null,
"it shouldn't be possible to create custom namespaces"
function verifySubjects(actual, expected, msg){
assert.strictEqual(actual.length, expected.length, msg);
expected.forEach(se => {
let matchingSubject = actual.find(sa => se._id == sa._id && se.name == sa.name);
assert.isObject(matchingSubject, `subject not found ${se._id} ${se.name}`);
verifySubjects(matchingSubject.children || [], se.children || [], `Checking children of ${matchingSubject.name}`); //I don't feel like adding children to every test object
});
}
dispatch = sinon.spy(function(action) {
//after start action dispatched
if (dispatch.callCount === 2) {
assert.strictEqual(action.type, `${actionName}_${steps.COMPLETED}`);
assert.strictEqual(action.payload, 2);
assert.strictEqual(action.meta.asyncStep, steps.COMPLETED);
done();
}
});
let e = engine.createEntity();
e.add(new SpyComponent());
e.add(new IndexComponent(i + 1));
engine.addEntity(e);
}
engine.update(deltaTime);
assert.strictEqual((numEntities / 2), entities.length);
for (let e of entities) {
let spyComponent = e.get(SpyComponent);
assert.isNotNull(spyComponent);
if (spyComponent)
assert.strictEqual(1, spyComponent.updates);
}
}
}
it('should disable the components, and render the IconButton with the disabled className', () => {
const wrapper = shallow();
assert.strictEqual(wrapper.props().disabled, true, 'should disable the root node');
assert.strictEqual(wrapper.childAt(1).props().disabled, true, 'should disable the input node');
});
it('lightens rgb black by 10% when coefficient is 0.1', () => {
assert.strictEqual(lighten('rgb(0, 0, 0)', 0.1), 'rgb(25, 25, 25)');
});