當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript helper.getDOMValue函數代碼示例

本文整理匯總了TypeScript中test/helper.getDOMValue函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getDOMValue函數的具體用法?TypeScript getDOMValue怎麽用?TypeScript getDOMValue使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了getDOMValue函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

    it('works', function() {
      document.body.appendChild(sandbox);

      var personTypeField = sandbox.querySelector('fieldset>labeled-select-field');
      assert.equal(getLabel(personTypeField), 'Gen persoană', 'has the appropriate label');
      assert.equal(getDOMValue(personTypeField), PersonSection.PERSON_TYPES.INDIVIDUAL, 'has the default value of “fizică”');

      var optionTexts = getOptionTexts(personTypeField.querySelector('select'));
      assert.equal(optionTexts.length, PersonSection.PERSON_TYPES.length, 'has the appropriate number of options');
      assert.deepEqual(optionTexts, PersonSection.PERSON_TYPES, 'has PERSON as the first option');

      setPersonType(PersonSection.PERSON_TYPES.COMPANY);
      var expectedFieldLabelTexts = ['Gen persoană', 'Denumire', 'IDNO', 'Sediu', 'Persoană de contact', 'Note'];
      assert.deepEqual(getLabelTexts(), expectedFieldLabelTexts, 'changes the fields appropriately');

      var nextFieldInput = getInputOfFieldBelowPersonTypeField(sandbox);
      assert.equal(document.activeElement, nextFieldInput, 'focuses the first field');

      document.body.removeChild(sandbox);

      function setPersonType(personType) {
        var select = personTypeField.querySelector('select');
        select.value = personType;
        select.dispatchEvent(new Event('change'));
      }
    });
開發者ID:gurdiga,項目名稱:xo,代碼行數:26,代碼來源:PersonSectionTest.ts

示例2: it

    it('has a field for the inquiry date', function() {
      var inquiryDate = fields[1];

      assert.ok(inquiryDate.tagName, 'LABELED-DATE-FIELD', 'is a labeled date field');
      assert.equal(inquiryDate.textContent, 'Data depunerii cererii',
        'has the appropriate label');
      assert.equal(getDOMValue(inquiryDate), fieldValues['data-depunerii'],
        'is prefilled with the appropriate value');
    });
開發者ID:gurdiga,項目名稱:xo,代碼行數:9,代碼來源:InquirySectionTest.ts

示例3: function

    return function(field, i) {
      var fieldElement = fieldElements[i];

      var expectedLabel   = field[0];
      var expectedTagName = field[1];
      var internalName    = field[2];
      var expectedValue   = fieldValues[internalName];

      var orderNo = i + 1;
      var messagePrefix = 'field #' + orderNo + ' — ' + internalName + ' — ';

      assert.equal(getLabel(fieldElement),   expectedLabel,   messagePrefix + 'has the appropriate label');
      assert.equal(getTagName(fieldElement), expectedTagName, messagePrefix + 'is of the appropriate kind');
      assert.equal(getDOMValue(fieldElement), expectedValue,  messagePrefix + 'is prefilled with the appropriate value');
    };
開發者ID:gurdiga,項目名稱:xo,代碼行數:15,代碼來源:PersonSectionTest.ts

示例4: it

  it('has the appropriate fields', function() {
    var fieldElements = domElement.querySelectorAll('fieldset>:not(legend)');

    var courtField = fieldElements[0];
    assert.equal(courtField.tagName, 'LABELED-SELECT-FIELD', 'the first field is a labeled-select-field');
    assert.equal(getLabel(courtField), 'Instanţa de judecată', 'the first field is “Instanţa de judecată”');
    assert.equal(getDOMValue(courtField), fieldValues['instanţa-de-judecată'],
      'the “Instanţa de judecată” field has preselected the given option');

    var sentenceNumberField = fieldElements[1];
    assert.equal(sentenceNumberField.tagName, 'LABELED-TEXT-FIELD', 'the second field is a labeled-text-field');
    assert.equal(getLabel(sentenceNumberField), 'Numărul hotărîrii', 'the second field is “Numărul hotărîrii”');
    assert.equal(getDOMValue(sentenceNumberField), fieldValues['numărul-hotărîrii'],
      'the “Numărul hotărîrii” field is prefilled with the given value');

    var sentenceDateField = fieldElements[2];
    assert.equal(sentenceDateField.tagName, 'LABELED-DATE-FIELD', 'the third field is a labeled-date-field');
    assert.equal(getLabel(sentenceDateField), 'Data hotărîrii', 'the third field is “Data hotărîrii”');
    assert.equal(getDOMValue(sentenceDateField), fieldValues['data-hotărîrii'],
      'the “Data hotărîrii” field is prefilled with the given value');

    var conclusionField = fieldElements[3];
    assert.equal(conclusionField.tagName, 'LABELED-LARGE-TEXT-FIELD', 'the fourth field is a labeled-large-text-field');
    assert.equal(getLabel(conclusionField), 'Dispozitivul',
      'the fourth field is “Dispozitivul”');
    assert.equal(getDOMValue(conclusionField), fieldValues['dispozitivul'],
      'the “Dispozitivul” field is prefilled with the given value');

    var caseSubjectField = fieldElements[4];
    assert.equal(caseSubjectField.tagName, 'LABELED-SELECT-FIELD', 'the fifth field is a labeled-select-field');
    assert.equal(getLabel(caseSubjectField), 'Obiectul urmăririi',
      'the fifth field is “Obiectul urmăririi”');
    assert.equal(getDOMValue(caseSubjectField), fieldValues['obiectul-urmăririi'],
      'the “Obiectul urmăririi” field is prefilled with the given value');

    var finalSentenceDateField = fieldElements[5];
    assert.equal(finalSentenceDateField.tagName, 'LABELED-DATE-FIELD', 'the sixth field is a labeled-date-field');
    assert.equal(getLabel(finalSentenceDateField), 'Data rămînerii definitive',
      'the sixth field is “Data rămînerii definitive”');
    assert.equal(getDOMValue(finalSentenceDateField), fieldValues['data-rămînerii-definitive'],
      'the “Data rămînerii definitive” field is prefilled with the given value');

    var releaseDateField = fieldElements[6];
    assert.equal(releaseDateField.tagName, 'LABELED-DATE-FIELD', 'the seventh field is a labeled-date-field');
    assert.equal(getLabel(releaseDateField), 'Data eliberării',
      'the sixth field is “Data eliberării”');
    assert.equal(getDOMValue(releaseDateField), fieldValues['data-eliberării'],
      'the “Data eliberării” field is prefilled with the given value');
  });
開發者ID:gurdiga,項目名稱:xo,代碼行數:49,代碼來源:SentenceSectionTest.ts


注:本文中的test/helper.getDOMValue函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。