• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript helper.assert函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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');
  });
开发者ID:gurdiga,项目名称:xo,代码行数:8,代码来源:CompletionLabelTest.ts


示例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');
  });
开发者ID:gurdiga,项目名称:xo,代码行数:10,代码来源:LabeledCheckboxTest.ts


示例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');
  });
开发者ID:gurdiga,项目名称:xo,代码行数:14,代码来源:DateFieldTest.ts


示例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');
  });
开发者ID:gurdiga,项目名称:xo,代码行数:27,代码来源:LabeledLargeTextFieldTest.ts


示例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');
 });
开发者ID:gurdiga,项目名称:xo,代码行数:7,代码来源:createDOMElementTest.ts


示例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');
  });
开发者ID:gurdiga,项目名称:xo,代码行数:16,代码来源:TodoItemTest.ts


示例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');
 });
开发者ID:gurdiga,项目名称:xo,代码行数:8,代码来源:createFieldTest.ts


示例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');
    });
开发者ID:gurdiga,项目名称:xo,代码行数:9,代码来源:DateFormattingTest.ts


示例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);
    }
开发者ID:gurdiga,项目名称:xo,代码行数:10,代码来源:DateFieldInputTest.ts


示例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');
  });
开发者ID:gurdiga,项目名称:xo,代码行数:14,代码来源:ActivitiesSectionTest.ts



注:本文中的test/helper.assert函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript helper.createSpy函数代码示例发布时间:2022-05-25
下一篇:
TypeScript authorization-check.checkAuthorizationGuards函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap