Some magic to make test work
This commit is contained in:
@@ -1,27 +1,33 @@
|
||||
package org.w3c.dom
|
||||
|
||||
import js.noImpl
|
||||
|
||||
/**
|
||||
* A stub class definition so we can work with the DOM APIs as native objects
|
||||
*/
|
||||
native public interface Document : Node {
|
||||
native public trait Document : Node {
|
||||
fun getElementById(id : String) : Element = js.noImpl
|
||||
fun createTextNode(text : String) : Node = js.noImpl
|
||||
}
|
||||
|
||||
native public interface Attr : Node {}
|
||||
native public interface CDATASection : Text {}
|
||||
native public interface CharacterData : Node {}
|
||||
native public interface Comment : CharacterData {}
|
||||
native public interface DOMImplementation {}
|
||||
native public interface DocumentType : Node {}
|
||||
native public interface Element : Node {}
|
||||
native public interface Entity : Node {}
|
||||
native public interface EntityReference : Node {}
|
||||
native public interface NameList {}
|
||||
native public interface NamedNodeMap {}
|
||||
native public interface Node {}
|
||||
native public interface NodeList {}
|
||||
native public interface Notation : Node {}
|
||||
native public interface ProcessingInstruction : Node {}
|
||||
native public interface Text : CharacterData {}
|
||||
native public interface TypeInfo {}
|
||||
native public interface UserDataHandler {}
|
||||
native public trait Attr : Node {}
|
||||
native public trait CDATASection : Text {}
|
||||
native public trait CharacterData : Node {}
|
||||
native public trait Comment : CharacterData {}
|
||||
native public trait DOMImplementation {}
|
||||
native public trait DocumentType : Node {}
|
||||
native public trait Element : Node {
|
||||
fun appendChild(child : Node) : Unit = js.noImpl
|
||||
}
|
||||
native public trait Entity : Node {}
|
||||
native public trait EntityReference : Node {}
|
||||
native public trait NameList {}
|
||||
native public trait NamedNodeMap {}
|
||||
native public trait Node {}
|
||||
native public trait NodeList {}
|
||||
native public trait Notation : Node {}
|
||||
native public trait ProcessingInstruction : Node {}
|
||||
native public trait Text : CharacterData {}
|
||||
native public trait TypeInfo {}
|
||||
native public trait UserDataHandler {}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package kotlin.browser
|
||||
|
||||
import org.w3c.dom.Document
|
||||
import js.native
|
||||
import js.library
|
||||
import org.w3c.dom.Document
|
||||
|
||||
/**
|
||||
* Provides access to the current active browsers DOM for the currently visible page.
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.facade.MainCallParameters;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
@@ -38,29 +37,16 @@ public final class StdLibTest extends SingleFileTranslationTest {
|
||||
public void testDummy() {
|
||||
}
|
||||
|
||||
public void TODO_testBrowserDocumentAccess() throws Exception {
|
||||
runFunctionOutputTest("browserDocumentAccess.kt", "test.browser", "foo", "Hello World!");
|
||||
public void testBrowserDocumentAccessCompiles() throws Exception {
|
||||
generateJavaScriptFiles("browserDocumentAccess.kt", MainCallParameters.noCall(), EcmaVersion.all());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateJavaScriptFiles(@NotNull String kotlinFilename,
|
||||
@NotNull MainCallParameters mainCallParameters,
|
||||
@NotNull EnumSet<EcmaVersion> ecmaVersions) throws Exception {
|
||||
|
||||
String stdlibdir = pathToTestFiles() + "../../../../libraries/stdlib/src/";
|
||||
String jscoredir = pathToTestFiles() + "../../../js.libraries/src/core/";
|
||||
|
||||
String dom = jscoredir + "dom.kt";
|
||||
String jsbrowser = jscoredir + "../stdlib/browser.kt";
|
||||
String stdlibBrowser = stdlibdir + "kotlin/browser/Properties.kt";
|
||||
|
||||
List<String> files = Arrays.asList(getInputFilePath(kotlinFilename), dom, jsbrowser);
|
||||
List<String> files = Arrays.asList(getInputFilePath(kotlinFilename));
|
||||
|
||||
generateJavaScriptFiles(files, kotlinFilename, mainCallParameters, ecmaVersions);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldCreateOut() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,9 @@ public abstract class Config {
|
||||
"/html5/canvas.kt",
|
||||
"/html5/files.kt",
|
||||
"/html5/image.kt",
|
||||
"/stdlib/JUMaps.kt"
|
||||
"/stdlib/JUMaps.kt",
|
||||
"/stdlib/browser.kt",
|
||||
"/core/dom.kt"
|
||||
);
|
||||
|
||||
protected static final String LIBRARIES_LOCATION = "js/js.libraries/src";
|
||||
|
||||
Reference in New Issue
Block a user