jaroslav@26: /** jaroslav@26: * Java 4 Browser Bytecode Translator jaroslav@26: * Copyright (C) 2012-2012 Jaroslav Tulach jaroslav@26: * jaroslav@26: * This program is free software: you can redistribute it and/or modify jaroslav@26: * it under the terms of the GNU General Public License as published by jaroslav@26: * the Free Software Foundation, version 2 of the License. jaroslav@26: * jaroslav@26: * This program is distributed in the hope that it will be useful, jaroslav@26: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@26: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@26: * GNU General Public License for more details. jaroslav@26: * jaroslav@26: * You should have received a copy of the GNU General Public License jaroslav@26: * along with this program. Look for COPYING file in the top folder. jaroslav@26: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@26: */ jaroslav@25: package org.apidesign.bck2brwsr.htmlpage; jaroslav@25: jaroslav@25: import java.io.IOException; jaroslav@25: import java.io.InputStream; jaroslav@25: import java.util.Set; jaroslav@25: import org.testng.annotations.Test; jaroslav@25: import static org.testng.Assert.*; jaroslav@25: jaroslav@26: import org.apidesign.bck2brwsr.htmlpage.api.*; jaroslav@26: jaroslav@25: public class ProcessPageTest { jaroslav@25: jaroslav@25: jaroslav@25: @Test public void findsThreeIds() throws IOException { jaroslav@25: InputStream is = ProcessPageTest.class.getResourceAsStream("TestPage.xhtml"); jaroslav@25: assertNotNull(is, "Sample HTML page found"); jaroslav@25: ProcessPage res = ProcessPage.readPage(is); jaroslav@25: final Set ids = res.ids(); jaroslav@25: assertEquals(ids.size(), 3, "Three ids found: " + ids); jaroslav@25: jaroslav@25: assertEquals(res.tagNameForId("pg.title"), "title"); jaroslav@25: assertEquals(res.tagNameForId("pg.button"), "button"); jaroslav@25: assertEquals(res.tagNameForId("pg.text"), "input"); jaroslav@25: } jaroslav@26: jaroslav@26: void testWhetherWeCanCallTheGeneratedIdFields() { jaroslav@26: Title t = TestPage.PG_TITLE; jaroslav@26: } jaroslav@28: jaroslav@28: @OnClick(id="pg.button") jaroslav@28: static void handleButtonClick() { jaroslav@28: jaroslav@28: } jaroslav@28: jaroslav@28: @Test public void testOnclickHandlerGenerated() { jaroslav@28: jaroslav@28: } jaroslav@25: }