| @@ 691-703 (lines=13) @@ | ||
| 688 | * |
|
| 689 | * @covers Grunion_Contact_Form_Field |
|
| 690 | */ |
|
| 691 | public function test_make_sure_text_field_renders_as_expected() { |
|
| 692 | $attributes = array( |
|
| 693 | 'label' => 'fun', |
|
| 694 | 'type' => 'text', |
|
| 695 | 'class' => 'lalala', |
|
| 696 | 'default' => 'foo', |
|
| 697 | 'placeholder' => 'PLACEHOLDTHIS!', |
|
| 698 | 'id' => 'funID', |
|
| 699 | ); |
|
| 700 | ||
| 701 | $expected_attributes = array_merge( $attributes, array( 'input_type' => 'text' ) ); |
|
| 702 | $this->assertValidField( $this->render_field( $attributes ), $expected_attributes ); |
|
| 703 | } |
|
| 704 | ||
| 705 | /** |
|
| 706 | * Test for email field_renders |
|
| @@ 710-722 (lines=13) @@ | ||
| 707 | * |
|
| 708 | * @covers Grunion_Contact_Form_Field |
|
| 709 | */ |
|
| 710 | public function test_make_sure_email_field_renders_as_expected() { |
|
| 711 | $attributes = array( |
|
| 712 | 'label' => 'fun', |
|
| 713 | 'type' => 'email', |
|
| 714 | 'class' => 'lalala', |
|
| 715 | 'default' => 'foo', |
|
| 716 | 'placeholder' => 'PLACEHOLDTHIS!', |
|
| 717 | 'id' => 'funID', |
|
| 718 | ); |
|
| 719 | ||
| 720 | $expected_attributes = array_merge( $attributes, array( 'input_type' => 'email' ) ); |
|
| 721 | $this->assertValidField( $this->render_field( $attributes ), $expected_attributes ); |
|
| 722 | } |
|
| 723 | ||
| 724 | /** |
|
| 725 | * Test for url field_renders |
|
| @@ 729-741 (lines=13) @@ | ||
| 726 | * |
|
| 727 | * @covers Grunion_Contact_Form_Field |
|
| 728 | */ |
|
| 729 | public function test_make_sure_url_field_renders_as_expected() { |
|
| 730 | $attributes = array( |
|
| 731 | 'label' => 'fun', |
|
| 732 | 'type' => 'url', |
|
| 733 | 'class' => 'lalala', |
|
| 734 | 'default' => 'foo', |
|
| 735 | 'placeholder' => 'PLACEHOLDTHIS!', |
|
| 736 | 'id' => 'funID', |
|
| 737 | ); |
|
| 738 | ||
| 739 | $expected_attributes = array_merge( $attributes, array( 'input_type' => 'url' ) ); |
|
| 740 | $this->assertValidField( $this->render_field( $attributes ), $expected_attributes ); |
|
| 741 | } |
|
| 742 | ||
| 743 | /** |
|
| 744 | * Test for telephone field_renders |
|
| @@ 748-760 (lines=13) @@ | ||
| 745 | * |
|
| 746 | * @covers Grunion_Contact_Form_Field |
|
| 747 | */ |
|
| 748 | public function test_make_sure_telephone_field_renders_as_expected() { |
|
| 749 | $attributes = array( |
|
| 750 | 'label' => 'fun', |
|
| 751 | 'type' => 'telephone', |
|
| 752 | 'class' => 'lalala', |
|
| 753 | 'default' => 'foo', |
|
| 754 | 'placeholder' => 'PLACEHOLDTHIS!', |
|
| 755 | 'id' => 'funID', |
|
| 756 | ); |
|
| 757 | ||
| 758 | $expected_attributes = array_merge( $attributes, array( 'input_type' => 'tel' ) ); |
|
| 759 | $this->assertValidField( $this->render_field( $attributes ), $expected_attributes ); |
|
| 760 | } |
|
| 761 | ||
| 762 | /** |
|
| 763 | * Test for date field_renders |
|
| @@ 767-779 (lines=13) @@ | ||
| 764 | * |
|
| 765 | * @covers Grunion_Contact_Form_Field |
|
| 766 | */ |
|
| 767 | public function test_make_sure_date_field_renders_as_expected() { |
|
| 768 | $attributes = array( |
|
| 769 | 'label' => 'fun', |
|
| 770 | 'type' => 'date', |
|
| 771 | 'class' => 'lalala', |
|
| 772 | 'default' => 'foo', |
|
| 773 | 'placeholder' => 'PLACEHOLDTHIS!', |
|
| 774 | 'id' => 'funID', |
|
| 775 | ); |
|
| 776 | ||
| 777 | $expected_attributes = array_merge( $attributes, array( 'input_type' => 'text' ) ); |
|
| 778 | $this->assertValidField( $this->render_field( $attributes ), $expected_attributes ); |
|
| 779 | } |
|
| 780 | ||
| 781 | /** |
|
| 782 | * Test for textarea field_renders |
|
| @@ 786-798 (lines=13) @@ | ||
| 783 | * |
|
| 784 | * @covers Grunion_Contact_Form_Field |
|
| 785 | */ |
|
| 786 | public function test_make_sure_textarea_field_renders_as_expected() { |
|
| 787 | $attributes = array( |
|
| 788 | 'label' => 'fun', |
|
| 789 | 'type' => 'textarea', |
|
| 790 | 'class' => 'lalala', |
|
| 791 | 'default' => 'foo', |
|
| 792 | 'placeholder' => 'PLACEHOLDTHIS!', |
|
| 793 | 'id' => 'funID', |
|
| 794 | ); |
|
| 795 | ||
| 796 | $expected_attributes = array_merge( $attributes, array( 'input_type' => 'textarea' ) ); |
|
| 797 | $this->assertValidField( $this->render_field( $attributes ), $expected_attributes ); |
|
| 798 | } |
|
| 799 | ||
| 800 | /** |
|
| 801 | * Test for checkbox field_renders |
|
| @@ 805-817 (lines=13) @@ | ||
| 802 | * |
|
| 803 | * @covers Grunion_Contact_Form_Field |
|
| 804 | */ |
|
| 805 | public function test_make_sure_checkbox_field_renders_as_expected() { |
|
| 806 | $attributes = array( |
|
| 807 | 'label' => 'fun', |
|
| 808 | 'type' => 'checkbox', |
|
| 809 | 'class' => 'lalala', |
|
| 810 | 'default' => 'foo', |
|
| 811 | 'placeholder' => 'PLACEHOLDTHIS!', |
|
| 812 | 'id' => 'funID', |
|
| 813 | ); |
|
| 814 | ||
| 815 | $expected_attributes = array_merge( $attributes, array( 'input_type' => 'checkbox' ) ); |
|
| 816 | $this->assertValidCheckboxField( $this->render_field( $attributes ), $expected_attributes ); |
|
| 817 | } |
|
| 818 | ||
| 819 | /** |
|
| 820 | * Multiple fields |
|