author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Sun, 22 Sep 2013 21:56:49 +0200 | |
changeset 1294 | 70532b5324e2 |
parent 772 | d382dacfd73f |
permissions | -rw-r--r-- |
jaroslav@518 | 1 |
/** |
jaroslav@518 | 2 |
* Back 2 Browser Bytecode Translator |
jaroslav@518 | 3 |
* Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
jaroslav@518 | 4 |
* |
jaroslav@518 | 5 |
* This program is free software: you can redistribute it and/or modify |
jaroslav@518 | 6 |
* it under the terms of the GNU General Public License as published by |
jaroslav@518 | 7 |
* the Free Software Foundation, version 2 of the License. |
jaroslav@518 | 8 |
* |
jaroslav@518 | 9 |
* This program is distributed in the hope that it will be useful, |
jaroslav@518 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
jaroslav@518 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
jaroslav@518 | 12 |
* GNU General Public License for more details. |
jaroslav@518 | 13 |
* |
jaroslav@518 | 14 |
* You should have received a copy of the GNU General Public License |
jaroslav@518 | 15 |
* along with this program. Look for COPYING file in the top folder. |
jaroslav@518 | 16 |
* If not, see http://opensource.org/licenses/GPL-2.0. |
jaroslav@518 | 17 |
*/ |
jaroslav@518 | 18 |
package org.apidesign.bck2brwsr.tck; |
jaroslav@518 | 19 |
|
jaroslav@518 | 20 |
import org.apidesign.bck2brwsr.core.JavaScriptBody; |
jaroslav@518 | 21 |
import org.apidesign.bck2brwsr.vmtest.BrwsrTest; |
jaroslav@526 | 22 |
import org.apidesign.bck2brwsr.vmtest.HtmlFragment; |
jaroslav@518 | 23 |
import org.apidesign.bck2brwsr.vmtest.VMTest; |
jaroslav@518 | 24 |
import org.testng.annotations.Factory; |
jaroslav@518 | 25 |
|
jaroslav@518 | 26 |
/** |
jaroslav@518 | 27 |
* |
jaroslav@518 | 28 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@518 | 29 |
*/ |
jaroslav@518 | 30 |
public class BrwsrCheckTest { |
jaroslav@526 | 31 |
|
jaroslav@518 | 32 |
@BrwsrTest public void assertWindowObjectIsDefined() { |
jaroslav@518 | 33 |
assert window() != null : "No window object found!"; |
jaroslav@518 | 34 |
} |
jaroslav@526 | 35 |
|
jaroslav@526 | 36 |
|
jaroslav@526 | 37 |
|
jaroslav@526 | 38 |
|
jaroslav@526 | 39 |
@HtmlFragment("<h1 id='hello'>\n" |
jaroslav@526 | 40 |
+ "Hello!\n" |
jaroslav@526 | 41 |
+ "</h1>\n") |
jaroslav@526 | 42 |
@BrwsrTest public void accessProvidedFragment() { |
jaroslav@526 | 43 |
assert getElementById("hello") != null : "Element with 'hello' ID found"; |
jaroslav@526 | 44 |
} |
jaroslav@518 | 45 |
|
jaroslav@518 | 46 |
@Factory |
jaroslav@518 | 47 |
public static Object[] create() { |
jaroslav@518 | 48 |
return VMTest.create(BrwsrCheckTest.class); |
jaroslav@518 | 49 |
} |
jaroslav@526 | 50 |
|
jaroslav@518 | 51 |
|
jaroslav@518 | 52 |
@JavaScriptBody(args = {}, body = "return window;") |
jaroslav@518 | 53 |
private static native Object window(); |
jaroslav@526 | 54 |
|
jaroslav@526 | 55 |
@JavaScriptBody(args = { "id" }, body = "return window.document.getElementById(id);") |
jaroslav@526 | 56 |
private static native Object getElementById(String id); |
jaroslav@518 | 57 |
} |