function testQuestionnaireUpdates() {
  var q = new vsaq.Questionnaire(root);
  var realChanges = {};
  var expectedChanges = {};
  var e = {};

  q.setTemplate(QUESTIONNAIRE);
  q.render();

  q.addEventListener(goog.events.EventType.CHANGE, function(e) {
    realChanges = e.changedValues;
  });

  // Tests updates to Boxes.
  var box = q.items_[BOX.id];
  box.textArea_.value = 'updated_value';
  e.target = box.textArea_;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[BOX.id] = box.textArea_.value;
  assertObjectEquals(expectedChanges, realChanges);

  // Tests updates to Lines.
  expectedChanges = {};
  realChanges = {};
  var line = q.items_[LINE.id];
  line.textBox_.value = 'updated_value';
  e.target = line.textBox_;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[LINE.id] = line.textBox_.value;
  assertObjectEquals(expectedChanges, realChanges);

  // Tests updates to Radios.
  expectedChanges = {};
  realChanges = {};
  var radio = q.items_[RADIO1.id];
  radio.setValue(true);
  e.target = radio.radioButton;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[RADIO1.id] = 'checked';
  expectedChanges[RADIO2.id] = '';
  assertObjectEquals(expectedChanges, realChanges);

  // Tests updates to Checks.
  expectedChanges = {};
  realChanges = {};
  var check = q.items_[CHECK.id];
  check.setValue(true);
  e.target = check.checkBox_;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[CHECK.id] = 'checked';
  assertObjectEquals(expectedChanges, realChanges);

  // Tests updates to YesNos.
  expectedChanges = {};
  realChanges = {};
  var yes = q.items_[YESNO.id];
  yes.setValue('yes');
  e.target = yes.yesRadio_;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[YESNO.id] = 'yes';
  assertObjectEquals(expectedChanges, realChanges);
}
/**
 * Tests updates to the questionnaire.
 */
Tests updates to the questionnaire.
Tests updates to the questionnaire .
function testQuestionnaireUpdates() {
  var q = new vsaq.Questionnaire(root);
  var realChanges = {};
  var expectedChanges = {};
  var e = {};
  q.setTemplate(QUESTIONNAIRE);
  q.render();
  q.addEventListener(goog.events.EventType.CHANGE, function(e) {
    realChanges = e.changedValues;
  });
  var box = q.items_[BOX.id];
  box.textArea_.value = 'updated_value';
  e.target = box.textArea_;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[BOX.id] = box.textArea_.value;
  assertObjectEquals(expectedChanges, realChanges);
  expectedChanges = {};
  realChanges = {};
  var line = q.items_[LINE.id];
  line.textBox_.value = 'updated_value';
  e.target = line.textBox_;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[LINE.id] = line.textBox_.value;
  assertObjectEquals(expectedChanges, realChanges);
  expectedChanges = {};
  realChanges = {};
  var radio = q.items_[RADIO1.id];
  radio.setValue(true);
  e.target = radio.radioButton;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[RADIO1.id] = 'checked';
  expectedChanges[RADIO2.id] = '';
  assertObjectEquals(expectedChanges, realChanges);
  expectedChanges = {};
  realChanges = {};
  var check = q.items_[CHECK.id];
  check.setValue(true);
  e.target = check.checkBox_;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[CHECK.id] = 'checked';
  assertObjectEquals(expectedChanges, realChanges);
  expectedChanges = {};
  realChanges = {};
  var yes = q.items_[YESNO.id];
  yes.setValue('yes');
  e.target = yes.yesRadio_;
  goog.events.fireListeners(e.target, goog.events.EventType.CHANGE, true, e);
  expectedChanges[YESNO.id] = 'yes';
  assertObjectEquals(expectedChanges, realChanges);
}
function testQuestionnaireUpdates ( ) { var q = new vsaq . Questionnaire ( root ) ; var realChanges = { } ; var expectedChanges = { } ; var e = { } ; q . setTemplate ( QUESTIONNAIRE ) ; q . render ( ) ; q . addEventListener ( goog . events . EventType . CHANGE , function ( e ) { realChanges = e . changedValues ; } ) ; var box = q . items_ [ BOX . id ] ; box . textArea_ . value = 'updated_value' ; e . target = box . textArea_ ; goog . events . fireListeners ( e . target , goog . events . EventType . CHANGE , true , e ) ; expectedChanges [ BOX . id ] = box . textArea_ . value ; assertObjectEquals ( expectedChanges , realChanges ) ; expectedChanges = { } ; realChanges = { } ; var line = q . items_ [ LINE . id ] ; line . textBox_ . value = 'updated_value' ; e . target = line . textBox_ ; goog . events . fireListeners ( e . target , goog . events . EventType . CHANGE , true , e ) ; expectedChanges [ LINE . id ] = line . textBox_ . value ; assertObjectEquals ( expectedChanges , realChanges ) ; expectedChanges = { } ; realChanges = { } ; var radio = q . items_ [ RADIO1 . id ] ; radio . setValue ( true ) ; e . target = radio . radioButton ; goog . events . fireListeners ( e . target , goog . events . EventType . CHANGE , true , e ) ; expectedChanges [ RADIO1 . id ] = 'checked' ; expectedChanges [ RADIO2 . id ] = '' ; assertObjectEquals ( expectedChanges , realChanges ) ; expectedChanges = { } ; realChanges = { } ; var check = q . items_ [ CHECK . id ] ; check . setValue ( true ) ; e . target = check . checkBox_ ; goog . events . fireListeners ( e . target , goog . events . EventType . CHANGE , true , e ) ; expectedChanges [ CHECK . id ] = 'checked' ; assertObjectEquals ( expectedChanges , realChanges ) ; expectedChanges = { } ; realChanges = { } ; var yes = q . items_ [ YESNO . id ] ; yes . setValue ( 'yes' ) ; e . target = yes . yesRadio_ ; goog . events . fireListeners ( e . target , goog . events . EventType . CHANGE , true , e ) ; expectedChanges [ YESNO . id ] = 'yes' ; assertObjectEquals ( expectedChanges , realChanges ) ; }
Tests updates to the questionnaire.
Tests updates to the questionnaire .
// Tests updates to Boxes. // Tests updates to Lines. // Tests updates to Radios. // Tests updates to Checks. // Tests updates to YesNos.