本文整理汇总了TypeScript中test/helper.assert函数的典型用法代码示例。如果您正苦于以下问题:TypeScript assert函数的具体用法?TypeScript assert怎么用?TypeScript assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('can be told to remove itself', function() {
var container = createDOMElement('div');
completionLabel.appendTo(container);
assert(container.children.length === 1, 'label added itself to the container');
completionLabel.remove();
assert(container.children.length === 0, 'label removed itself to the container');
});
示例2: it
it('announces its changes', function() {
var callback = createSpy();
labeledCheckbox.setValue(false);
labeledCheckbox.onChange(callback);
checkbox.click();
assert(callback.executed, 'calls the given callback');
assert(callback.calls[0].args[0] === true, 'the callback is passed the current state of the checkbox');
});
示例3: it
it('has a date picker button', function() {
var button = domElement.querySelector('button');
assert.equal(button.title, 'Deschide calendarul', 'has the appropriate tooltip');
var datePickerElement;
button.click();
datePickerElement = domElement.querySelector(DateFieldInput.DATE_PICKER_SELECTOR);
assert(datePickerElement, 'displays the date picker on click');
button.click();
datePickerElement = domElement.querySelector(DateFieldInput.DATE_PICKER_SELECTOR);
assert(!datePickerElement, 'hides the date picker clicking the second time');
});
示例4: it
it('is styled appropriately', function() {
var css = textarea.style;
assert.equal(css.color, 'black', 'its text renders in black color');
assert.equal(css.padding, '4px', 'has 4px of padding, as the LabeledTextField input does');
assert.equal(css.marginLeft, '1em', 'has 1em of margin at the left, to stand out of the label vertical alignment');
assert.equal(css.marginBottom, '5px', 'a bit of space at the bottom not to stick to the next select');
assert.equal(css.fontWeight, 'bold', 'has bold text as the LabeledTextField input does');
assert.equal(css.fontSize, '14px', 'has 14px font size as the LabeledTextField input does');
assert.equal(css.fontFamily, 'sans-serif', 'has sans-serif font-family as the LabeledTextField input does');
assert.equal(css.lineHeight, '1.75', 'has a 1.75 line height to accommodate the lines on the background');
assert.equal(css.width, '340px', 'is 340px wide to wrap to the next line and right align with the LabeledTextField input');
assert.equal(css.height, '5.8em', 'is 5.8em high to neatly accommodate 3 lines of text');
assert.equal(
css.backgroundImage,
'url("data:image/gif;base64,R0lGODlhMgAYAIABAN3d3f///yH5BAEKAAEALAAAAAAyABgAAAIrjI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyrAGBjd96zu9+D/wFCgA7")',
'has the image of a fine dotted line on the background');
assert.equal(css.borderRadius, '2px', 'has a subtle 2px border-radius as the LabeledTextField input does');
assert.equal(css.borderWidth, '0px',
'has no border because it’s replaced by the dotted line on the background image and the artificial outline');
assert.equal(css.outlineWidth, '0px',
'has the built-in outline disabled because it’s replaces by the nicer artificial outline');
assert.equal(css.resize, 'none', 'has the built-in resize control disabled because it will be made elastic');
assert.equal(css.display, 'block', 'is block because needs to place under the label');
assert(textarea.hasAttribute('has-on-focus-effect'), 'is outlined on focus');
});
示例5: it
it('works', function() {
assert(domElement instanceof HTMLElement, 'creates an HTMLElement');
assert.equal(domElement.tagName, 'SOME-COMPONENT', 'the element has the appropriate tag name');
assert.deepEqual(domElement.style.color, 'green', 'the element gets the passed in style attributes');
assert.deepEqual(domElement.getAttribute('widget-name'), 'SpecialWidget',
'the element gets the passed in attributes');
});
示例6: it
it('has the container for the completion label', function() {
var completionLabelContainer = domElement.querySelector('completion-label-container');
assert(completionLabelContainer, 'the container exists');
assert.equal(completionLabelContainer.innerHTML, '', 'the container is empty');
todoItem.setData({
'is-completed': true,
'completion-time': '2000-11-23T17:15:28.484Z'
});
var completionLabel = completionLabelContainer.firstChild;
assert(completionLabel !== null, 'completion label is rendered');
var style = completionLabel.style;
assert.equal(style.marginLeft, '0.5em', 'completion label has a little left spacing');
});
示例7: it
it('works', function() {
assert(field instanceof LabeledTextField, 'creates an instance of the given field');
assert.equal(field.internalName, internalName, 'sets the internalName as given');
assert.equal(field.getValue(), fieldValues['first-name'], 'sets the field value as given');
assert.equal(getLabel(fieldElement), labelText, 'sets the field label as given');
assert.equal(fieldElement.getAttribute('internal-name'), internalName,
'puts the given internal name in the “internal-name” attribute');
});
示例8: it
it('works for the happy path', function() {
assert(_.isDate(date),
'parses the string given as the first argument according' +
' to the string mask passed in the second argument and returns a date object');
assert.equal(date.getDate(), 7, 'returned date has the appropriate date');
assert.equal(date.getMonth(), 5, 'returned date has the appropriate month');
assert.equal(date.getFullYear(), 2015, 'returned date has the appropriate year');
});
示例9: getDatePickerSelectedDate
function getDatePickerSelectedDate() {
var selectedDate = datePicker.querySelector('.is-selected .pika-day');
assert(selectedDate, 'getDatePickerSelectedDate() expects a selected date in the date picker');
var year = selectedDate.getAttribute('data-pika-year');
var month = selectedDate.getAttribute('data-pika-month');
var day = selectedDate.getAttribute('data-pika-day');
return DateFormatting.format(new Date(year, month, day), DateFieldInput.DATE_FORMAT);
}
示例10: it
it('setActivities() adds the given activity widgets', function() {
var activityData = {
'widgetClassName': 'InstitutionActivity',
'date': Date.now(),
'todo-items': []
};
var activitiesArray = [activityData];
activitiesSection.setActivities(activitiesArray);
var institutionActivity = domElement.querySelector('[name="activity-list-container"]>[widget-name="InstitutionActivity"]');
assert(institutionActivity, 'institution activity is added');
});