added test case trying to get the document property working on JS - not quite there yet :(
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package org.w3c.dom
|
||||
|
||||
/**
|
||||
* A stub class definition so we can work with the DOM APIs as native objects
|
||||
*/
|
||||
native interface Document : Node {
|
||||
}
|
||||
|
||||
native interface Attr : Node {}
|
||||
native interface CDATASection : Text {}
|
||||
native interface CharacterData : Node {}
|
||||
native interface Comment : CharacterData {}
|
||||
native interface DOMImplementation {}
|
||||
native interface DocumentType : Node {}
|
||||
native interface Element : Node {}
|
||||
native interface Entity : Node {}
|
||||
native interface EntityReference : Node {}
|
||||
native interface NameList {}
|
||||
native interface NamedNodeMap {}
|
||||
native interface Node {}
|
||||
native interface NodeList {}
|
||||
native interface Notation : Node {}
|
||||
native interface ProcessingInstruction : Node {}
|
||||
native interface Text : CharacterData {}
|
||||
native interface TypeInfo {}
|
||||
native interface UserDataHandler {}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package kotlin.browser
|
||||
|
||||
import org.w3c.dom.Document
|
||||
import js.native
|
||||
import js.library
|
||||
|
||||
/**
|
||||
* Provides access to the current active browsers DOM for the currently visible page.
|
||||
*/
|
||||
native("document") var document: Document
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,12 +48,13 @@ public final class StdLibTest extends SingleFileTranslationTest {
|
||||
@NotNull EnumSet<EcmaVersion> ecmaVersions) throws Exception {
|
||||
|
||||
String stdlibdir = pathToTestFiles() + "../../../../libraries/stdlib/src/";
|
||||
String browser = stdlibdir + "kotlin/browser/Properties.kt";
|
||||
String jscoredir = pathToTestFiles() + "../../../js.libraries/src/core/";
|
||||
|
||||
File file = new File(browser);
|
||||
assertTrue("Could not find file: " + browser, file.exists());
|
||||
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), browser);
|
||||
List<String> files = Arrays.asList(getInputFilePath(kotlinFilename), dom, jsbrowser);
|
||||
|
||||
generateJavaScriptFiles(files, kotlinFilename, mainCallParameters, ecmaVersions);
|
||||
}
|
||||
@@ -63,5 +63,4 @@ public final class StdLibTest extends SingleFileTranslationTest {
|
||||
protected boolean shouldCreateOut() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user