jaroslav@1018: /** jaroslav@1018: * Back 2 Browser Bytecode Translator jaroslav@1018: * Copyright (C) 2012 Jaroslav Tulach jaroslav@1018: * jaroslav@1018: * This program is free software: you can redistribute it and/or modify jaroslav@1018: * it under the terms of the GNU General Public License as published by jaroslav@1018: * the Free Software Foundation, version 2 of the License. jaroslav@1018: * jaroslav@1018: * This program is distributed in the hope that it will be useful, jaroslav@1018: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@1018: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@1018: * GNU General Public License for more details. jaroslav@1018: * jaroslav@1018: * You should have received a copy of the GNU General Public License jaroslav@1018: * along with this program. Look for COPYING file in the top folder. jaroslav@1018: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@1018: */ jaroslav@1018: package org.apidesign.bck2brwsr.htmlpage; jaroslav@1018: jaroslav@1018: import java.util.Map; jaroslav@1018: import net.java.html.json.Context; jaroslav@1018: import org.apidesign.bck2brwsr.core.JavaScriptBody; jaroslav@1018: import org.apidesign.bck2brwsr.vmtest.VMTest; jaroslav@1018: import org.apidesign.html.json.tck.KnockoutTCK; jaroslav@1018: import org.openide.util.lookup.ServiceProvider; jaroslav@1018: import org.testng.annotations.Factory; jaroslav@1018: jaroslav@1018: /** jaroslav@1018: * jaroslav@1018: * @author Jaroslav Tulach jaroslav@1018: */ jaroslav@1018: @ServiceProvider(service = KnockoutTCK.class) jaroslav@1018: public final class Bck2BrwsrKnockoutTest extends KnockoutTCK { jaroslav@1018: @Factory public static Object[] create() { jaroslav@1018: return VMTest.create(testClasses()); jaroslav@1018: } jaroslav@1018: jaroslav@1018: @Override jaroslav@1018: public Context createContext() { jaroslav@1018: return BrwsrCntxt.DEFAULT; jaroslav@1018: } jaroslav@1018: jaroslav@1018: jaroslav@1018: jaroslav@1018: @Override jaroslav@1018: public Object createJSON(Map values) { jaroslav@1018: Object json = createJSON(); jaroslav@1018: jaroslav@1018: for (Map.Entry entry : values.entrySet()) { jaroslav@1018: putValue(json, entry.getKey(), entry.getValue()); jaroslav@1018: } jaroslav@1018: return json; jaroslav@1018: } jaroslav@1018: jaroslav@1018: @JavaScriptBody(args = {}, body = "return new Object();") jaroslav@1018: private static native Object createJSON(); jaroslav@1018: jaroslav@1018: @JavaScriptBody(args = { "json", "key", "value" }, body = "json[key] = value;") jaroslav@1018: private static native void putValue(Object json, String key, Object value); jaroslav@1018: }