public void FindInterfaceWithMember_OnAWindowElementLookingForNameMethod_ReturnsInterfaceThatContainsMethodNode() { _browser.TestLoadHtml("hello world"); using (var context = new AutoJSContext(_browser.Window)) { var jsValWindow = context.EvaluateScript("this"); var jsVal = SpiderMonkeyTests.CreateStringJsVal(context, "name"); var jsObject = SpiderMonkey.JS_ValueToObject(context.ContextPointer, jsValWindow); var a = m_instance.GetWrappedNativeOfJSObject(context.ContextPointer, jsObject); // Perform the test. var i = a.FindInterfaceWithMember(ref jsVal.AsPtr); Assert.NotNull(i); Assert.IsTrue(i.IsScriptable()); Assert.AreEqual("nsIDOMWindow", i.GetNameShared()); } }
public void FindInterfaceWithName_OnAWindowElementLookingForADOMWindowInterface_ReturnsExpectedInterface() { _browser.TestLoadHtml("hello world"); using (var context = new AutoJSContext(_browser.Window.JSContext)) { context.PushCompartmentScope((nsISupports)_browser.Window.DomWindow); var jsValWindow = context.EvaluateScript("this"); var jsVal = SpiderMonkeyTests.CreateStringJsVal(context, "nsIDOMWindow"); var jsObject = SpiderMonkey.JS_ValueToObject(context.ContextPointer, jsValWindow); var a = m_instance.GetWrappedNativeOfJSObject(context.ContextPointer, jsObject); // Perform the test var i = a.FindInterfaceWithName(ref jsVal.AsPtr); Assert.NotNull(i); Assert.IsTrue(i.IsScriptable()); Assert.AreEqual("nsIDOMWindow", i.GetNameShared()); } }
public void IsString_OnNumberJsVal_RetrunsFalse() { JsVal numberJsVal = SpiderMonkeyTests.CreateNumberJsVal(23); Assert.IsFalse(numberJsVal.IsString); }
public void IsString_OnStringJsVal_RetrunsTrue() { JsVal stringJsVal = SpiderMonkeyTests.CreateStringJsVal("hello world"); Assert.IsTrue(stringJsVal.IsString); }
public void Type_OnNumberJsVal_ReturnsNumberType() { JsVal numberJsVal = SpiderMonkeyTests.CreateNumberJsVal(23); Assert.AreEqual(JSType.JSTYPE_NUMBER, numberJsVal.Type); }
public void Type_OnStringJsVal_RetrunsStringType() { JsVal stringJsVal = SpiderMonkeyTests.CreateStringJsVal("hello world"); Assert.AreEqual(JSType.JSTYPE_STRING, stringJsVal.Type); }
public void ToString_OnBoolJsVal_ReturnsNumberContentsConvertedToAString() { JsVal stringJsVal = SpiderMonkeyTests.CreateBoolJsVal(false); Assert.AreEqual("false", stringJsVal.ToString()); }
public void ToString_OnNumberJsVal_ReturnsNumberContentsConvertedToAString() { JsVal stringJsVal = SpiderMonkeyTests.CreateNumberJsVal(23); Assert.AreEqual("23", stringJsVal.ToString()); }
public void ToString_OnStringJsVal_ReturnsStringContents() { JsVal stringJsVal = SpiderMonkeyTests.CreateStringJsVal("hello world"); Assert.AreEqual("hello world", stringJsVal.ToString()); }