function assertIf(block, ifCount, hasElse) {
    const inputs = block.inputList;
    const length = inputs.length;
    assert.equal(length, hasElse ? ifCount * 2 + 1 : ifCount * 2);
    for (let i = 0; i < ifCount; i++) {
      assert.equal(inputs[i * 2].name, 'IF' + i);
      assert.equal(inputs[i * 2 + 1].name, 'DO' + i);
      if (i > 0) {
        assert.isNotNull(block.getField('MINUS' + i));
      }
    }
    if (hasElse) {
      assert.equal(inputs[length - 1].name, 'ELSE');
    }
  }
/**
   * Assert that the if block has the expected inputs and fields.
   * @param {!Blockly.Block} block The if block to check.
   * @param {number} ifCount The number of ifs we expect.
   * @param {number} hasElse If we expect an else input.
   */
Assert that the if block has the expected inputs and fields.
@param {!Blockly.Block} block The if block to check.
@param {number} ifCount The number of ifs we expect.
@param {number} hasElse If we expect an else input.
Assert that the if block has the expected inputs and fields . @param { !Blockly . Block } block The if block to check . @param { number } ifCount The number of ifs we expect . @param { number } hasElse If we expect an else input .
function assertIf(block, ifCount, hasElse) {
    const inputs = block.inputList;
    const length = inputs.length;
    assert.equal(length, hasElse ? ifCount * 2 + 1 : ifCount * 2);
    for (let i = 0; i < ifCount; i++) {
      assert.equal(inputs[i * 2].name, 'IF' + i);
      assert.equal(inputs[i * 2 + 1].name, 'DO' + i);
      if (i > 0) {
        assert.isNotNull(block.getField('MINUS' + i));
      }
    }
    if (hasElse) {
      assert.equal(inputs[length - 1].name, 'ELSE');
    }
  }
function assertIf ( block , ifCount , hasElse ) { const inputs = block . inputList ; const length = inputs . length ; assert . equal ( length , hasElse ? ifCount * 2 + 1 : ifCount * 2 ) ; for ( let i = 0 ; i < ifCount ; i ++ ) { assert . equal ( inputs [ i * 2 ] . name , 'IF' + i ) ; assert . equal ( inputs [ i * 2 + 1 ] . name , 'DO' + i ) ; if ( i > 0 ) { assert . isNotNull ( block . getField ( 'MINUS' + i ) ) ; } } if ( hasElse ) { assert . equal ( inputs [ length - 1 ] . name , 'ELSE' ) ; } }
Assert that the if block has the expected inputs and fields.
Assert that the if block has the expected inputs and fields .