/*
 * Copyright 2004-2011 the Seasar Foundation and the Others.
 *
 * 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 org.seasar.teeda.it.render;

import junit.framework.Test;

import org.seasar.teeda.unit.web.TeedaWebTestCase;
import org.seasar.teeda.unit.web.TeedaWebTester;

/**
 * @author manhole
 */
public class InputTextareaTest extends TeedaWebTestCase {

	public static Test suite() throws Exception {
		return setUpTest(InputTextareaTest.class);
	}

	// https://www.seasar.org/issues/browse/TEEDA-230
	public void testJIRA230() throws Exception {
		// ## Arrange ##
		TeedaWebTester tester = new TeedaWebTester();

		// ## Act ##
		tester.beginAt(getBaseUrl(), "view/textarea/textarea1.html");
		tester.dumpHtml();

		// ## Assert ##
		tester.assertTitleEquals("textarea 1");
		tester.assertTextEqualsById("aaa", "AAA");
		tester.assertTextEqualsById("bbb", "");
		tester.assertTextEqualsById("ccc", "12345");
		tester.assertTextPresent("AAA");
		tester.assertTextNotPresent("BBB");
		tester.assertTextNotPresent("CCC");
	}

	// https://www.seasar.org/issues/browse/TEEDA-425
	public void testTEEDA425() throws Exception {
		// ## Arrange ##
		TeedaWebTester tester = new TeedaWebTester();

		// ## Act ##
		tester.beginAt(getBaseUrl(), "view/textarea/textareaInput.html");
		tester.dumpHtml();
		tester.setTextById("aaa", "aaa<br>bbb\nccc");
		tester.submitById("doExec");

		// ## Assert ##
		tester.assertTextEqualsById("aaa", "aaa<br>bbb ccc");
	}

}
