function testGroupItem() {

  var defaultChoiceFound;

  // First verify the correctness of check groups.
  defaultChoiceFound = false;

  var expectedNumberChoices = TEST_CHECKGROUP.choices.length;

  if (TEST_CHECKGROUP['defaultChoice'])
    expectedNumberChoices++;
  assert(expectedNumberChoices == checkgroupItem.containerItems.length);

  goog.array.forEach(checkgroupItem.containerItems, function(item) {
    assert(item instanceof vsaq.questionnaire.items.CheckItem);
    // All choices are supposed to have the containerItem as a parent.
    assertNotUndefined(item.parentItem);

    if (item.text == vsaq.questionnaire.items.GroupItem.DEFAULT_CHOICE)
      defaultChoiceFound = true;
  });
  assert(defaultChoiceFound == TEST_CHECKGROUP['defaultChoice']);

  // Now verify the correctness of radio groups.
  defaultChoiceFound = false;
  expectedNumberChoices = TEST_RADIOGROUP.choices.length;
  if (TEST_RADIOGROUP['defaultChoice'])
    expectedNumberChoices++;
  assert(expectedNumberChoices == radiogroupItem.containerItems.length);

  goog.array.forEach(radiogroupItem.containerItems, function(item) {
    assert(item instanceof vsaq.questionnaire.items.RadioItem);
    // All choices are supposed to have the containerItem as a parent.
    assertNotUndefined(item.parentItem);

    if (item.text == vsaq.questionnaire.items.GroupItem.DEFAULT_CHOICE)
      defaultChoiceFound = true;
  });
  assert(defaultChoiceFound == TEST_RADIOGROUP['defaultChoice']);
}
/**
 * Tests whether all possible GroupItems are initialized correctly.
 */
Tests whether all possible GroupItems are initialized correctly.
Tests whether all possible GroupItems are initialized correctly .
function testGroupItem() {
  var defaultChoiceFound;
  defaultChoiceFound = false;
  var expectedNumberChoices = TEST_CHECKGROUP.choices.length;
  if (TEST_CHECKGROUP['defaultChoice'])
    expectedNumberChoices++;
  assert(expectedNumberChoices == checkgroupItem.containerItems.length);
  goog.array.forEach(checkgroupItem.containerItems, function(item) {
    assert(item instanceof vsaq.questionnaire.items.CheckItem);
    assertNotUndefined(item.parentItem);
    if (item.text == vsaq.questionnaire.items.GroupItem.DEFAULT_CHOICE)
      defaultChoiceFound = true;
  });
  assert(defaultChoiceFound == TEST_CHECKGROUP['defaultChoice']);
  defaultChoiceFound = false;
  expectedNumberChoices = TEST_RADIOGROUP.choices.length;
  if (TEST_RADIOGROUP['defaultChoice'])
    expectedNumberChoices++;
  assert(expectedNumberChoices == radiogroupItem.containerItems.length);
  goog.array.forEach(radiogroupItem.containerItems, function(item) {
    assert(item instanceof vsaq.questionnaire.items.RadioItem);
    assertNotUndefined(item.parentItem);
    if (item.text == vsaq.questionnaire.items.GroupItem.DEFAULT_CHOICE)
      defaultChoiceFound = true;
  });
  assert(defaultChoiceFound == TEST_RADIOGROUP['defaultChoice']);
}
function testGroupItem ( ) { var defaultChoiceFound ; defaultChoiceFound = false ; var expectedNumberChoices = TEST_CHECKGROUP . choices . length ; if ( TEST_CHECKGROUP [ 'defaultChoice' ] ) expectedNumberChoices ++ ; assert ( expectedNumberChoices == checkgroupItem . containerItems . length ) ; goog . array . forEach ( checkgroupItem . containerItems , function ( item ) { assert ( item instanceof vsaq . questionnaire . items . CheckItem ) ; assertNotUndefined ( item . parentItem ) ; if ( item . text == vsaq . questionnaire . items . GroupItem . DEFAULT_CHOICE ) defaultChoiceFound = true ; } ) ; assert ( defaultChoiceFound == TEST_CHECKGROUP [ 'defaultChoice' ] ) ; defaultChoiceFound = false ; expectedNumberChoices = TEST_RADIOGROUP . choices . length ; if ( TEST_RADIOGROUP [ 'defaultChoice' ] ) expectedNumberChoices ++ ; assert ( expectedNumberChoices == radiogroupItem . containerItems . length ) ; goog . array . forEach ( radiogroupItem . containerItems , function ( item ) { assert ( item instanceof vsaq . questionnaire . items . RadioItem ) ; assertNotUndefined ( item . parentItem ) ; if ( item . text == vsaq . questionnaire . items . GroupItem . DEFAULT_CHOICE ) defaultChoiceFound = true ; } ) ; assert ( defaultChoiceFound == TEST_RADIOGROUP [ 'defaultChoice' ] ) ; }
Tests whether all possible GroupItems are initialized correctly.
Tests whether all possible GroupItems are initialized correctly .
// First verify the correctness of check groups. // All choices are supposed to have the containerItem as a parent. // Now verify the correctness of radio groups. // All choices are supposed to have the containerItem as a parent.