/*
* Copyright 2013 Objectos, Fábrica de Software LTDA.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package br.com.objectos.way.ui.builder;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasToString;
import org.testng.annotations.Test;
import br.com.objectos.way.ui.builder.Html;
import br.com.objectos.way.ui.builder.HtmlButton;
/**
* @author carolene.bertoldi@objectos.com.br (Carolene Reis Silva Bertoldi)
*/
@Test
public class HtmlButtonTest {
public void button_teste() {
HtmlButton ui = Html.button().end();
assertThat(ui, hasToString(equalTo("<button></button>")));
}
public void button_text() {
HtmlButton ui = Html.button()
.text("Button")
.end();
assertThat(ui, hasToString(equalTo("<button>Button</button>")));
}
public void button_type() {
HtmlButton ui = Html.button()
.type("submit")
.end();
assertThat(ui, hasToString(equalTo("<button type=\"submit\"></button>")));
}
public void button_style() {
HtmlButton ui = Html.button()
.styleClass("btn")
.end();
assertThat(ui, hasToString(equalTo("<button class=\"btn\"></button>")));
}
public void button_data_way_multi_submit() {
HtmlButton ui = Html.button()
.multiSubmit("limite-list")
.end();
assertThat(ui, hasToString(equalTo("<button data-way-multi-submit=\"limite-list\"></button>")));
}
}