Exemple #1
0
 function testIdAttrValue()
 {
     $field = new CMB_Text_Field('foo', 'Text', array(1, 2));
     // Standard use of ID attribute
     $id_attr = $field->get_the_id_attr();
     $this->assertEquals($id_attr, 'foo-cmb-field-0');
     // Using append
     $id_attr = $field->get_the_id_attr('bar');
     $this->assertEquals($id_attr, 'foo-cmb-field-0-bar');
     // Repeatable
     $field->field_index = 1;
     $id_attr = $field->get_the_id_attr();
     $this->assertEquals($id_attr, 'foo-cmb-field-1');
 }
 function testIdAttrValue()
 {
     $field = new CMB_Text_Field('foo', 'Text', array(1, 2));
     // Standard use of ID attribute
     $id_attr = $field->get_the_id_attr();
     $this->assertEquals($id_attr, 'foo-cmb-field-0');
     // Using append
     $id_attr = $field->get_the_id_attr('bar');
     $this->assertEquals($id_attr, 'foo-cmb-field-0-bar');
     // Repeatable
     $field->field_index = 1;
     $id_attr = $field->get_the_id_attr();
     $this->assertEquals($id_attr, 'foo-cmb-field-1');
     // Test more than 10 fields
     // See https://github.com/humanmade/Custom-Meta-Boxes/pull/164
     $field->field_index = 12;
     $id_attr = $field->get_the_id_attr();
     $this->assertEquals($id_attr, 'foo-cmb-field-12');
 }