author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Tue, 25 Sep 2012 09:55:34 +0200 | |
changeset 28 | 81ad7a739fed |
parent 26 | 03e4aaa4ef3d |
child 100 | 029e6eed60e9 |
permissions | -rw-r--r-- |
jaroslav@26 | 1 |
/** |
jaroslav@26 | 2 |
* Java 4 Browser Bytecode Translator |
jaroslav@26 | 3 |
* Copyright (C) 2012-2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
jaroslav@26 | 4 |
* |
jaroslav@26 | 5 |
* This program is free software: you can redistribute it and/or modify |
jaroslav@26 | 6 |
* it under the terms of the GNU General Public License as published by |
jaroslav@26 | 7 |
* the Free Software Foundation, version 2 of the License. |
jaroslav@26 | 8 |
* |
jaroslav@26 | 9 |
* This program is distributed in the hope that it will be useful, |
jaroslav@26 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
jaroslav@26 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
jaroslav@26 | 12 |
* GNU General Public License for more details. |
jaroslav@26 | 13 |
* |
jaroslav@26 | 14 |
* You should have received a copy of the GNU General Public License |
jaroslav@26 | 15 |
* along with this program. Look for COPYING file in the top folder. |
jaroslav@26 | 16 |
* If not, see http://opensource.org/licenses/GPL-2.0. |
jaroslav@26 | 17 |
*/ |
jaroslav@25 | 18 |
package org.apidesign.bck2brwsr.htmlpage; |
jaroslav@25 | 19 |
|
jaroslav@25 | 20 |
import java.io.IOException; |
jaroslav@25 | 21 |
import java.io.InputStream; |
jaroslav@25 | 22 |
import java.util.Set; |
jaroslav@25 | 23 |
import org.testng.annotations.Test; |
jaroslav@25 | 24 |
import static org.testng.Assert.*; |
jaroslav@25 | 25 |
|
jaroslav@26 | 26 |
import org.apidesign.bck2brwsr.htmlpage.api.*; |
jaroslav@26 | 27 |
|
jaroslav@25 | 28 |
public class ProcessPageTest { |
jaroslav@25 | 29 |
|
jaroslav@25 | 30 |
|
jaroslav@25 | 31 |
@Test public void findsThreeIds() throws IOException { |
jaroslav@25 | 32 |
InputStream is = ProcessPageTest.class.getResourceAsStream("TestPage.xhtml"); |
jaroslav@25 | 33 |
assertNotNull(is, "Sample HTML page found"); |
jaroslav@25 | 34 |
ProcessPage res = ProcessPage.readPage(is); |
jaroslav@25 | 35 |
final Set<String> ids = res.ids(); |
jaroslav@25 | 36 |
assertEquals(ids.size(), 3, "Three ids found: " + ids); |
jaroslav@25 | 37 |
|
jaroslav@25 | 38 |
assertEquals(res.tagNameForId("pg.title"), "title"); |
jaroslav@25 | 39 |
assertEquals(res.tagNameForId("pg.button"), "button"); |
jaroslav@25 | 40 |
assertEquals(res.tagNameForId("pg.text"), "input"); |
jaroslav@25 | 41 |
} |
jaroslav@26 | 42 |
|
jaroslav@26 | 43 |
void testWhetherWeCanCallTheGeneratedIdFields() { |
jaroslav@26 | 44 |
Title t = TestPage.PG_TITLE; |
jaroslav@26 | 45 |
} |
jaroslav@28 | 46 |
|
jaroslav@28 | 47 |
@OnClick(id="pg.button") |
jaroslav@28 | 48 |
static void handleButtonClick() { |
jaroslav@28 | 49 |
|
jaroslav@28 | 50 |
} |
jaroslav@28 | 51 |
|
jaroslav@28 | 52 |
@Test public void testOnclickHandlerGenerated() { |
jaroslav@28 | 53 |
|
jaroslav@28 | 54 |
} |
jaroslav@25 | 55 |
} |