public void DomContentChanged_ChangeContentOfTextInputWithKeyPressAndMoveToSecondInput_DomContentChangedShouldFire()
        {
            string html = "<input id=\"one\" type=\"text\" value=\"hello\" /><input id=\"two\" type=\"text\"  value=\"world\" />";

            LoadHtml(html);

            // Place browser on a form and show it. This is need to make the gecko accept the key press.
            Form f = new Form();

            f.Controls.Add(browser);
            browser.Visible = true;
            f.Show();

            // Focus first input box
            browser.Document.GetElementById("one").Focus();
            GeckoRange range = browser.Document.CreateRange();

            range.SelectNode(browser.Document.GetElementById("one"));
            browser.Window.Selection.AddRange(range);

            // record if DomContentChanged event happened.
            bool contentChangedEventReceived = false;

            browser.DomContentChanged += (sender, e) => contentChangedEventReceived = true;


            // Modify first input by sending a keypress.
            // TODO: create wrapper for nsIDOMWindowUtils
            nsIDOMWindowUtils utils = Xpcom.QueryInterface <nsIDOMWindowUtils>(browser.Window.DomWindow);

            using (nsAString type = new nsAString("keypress"))
            {
                utils.SendKeyEvent(type, 0, 102, 0, false);
            }

            // DomContentChanged Event should fire when we move we move to next element.
            browser.Document.GetElementById("two").Focus();
            range.SelectNode(browser.Document.GetElementById("two"));
            browser.Window.Selection.RemoveAllRanges();
            browser.Window.Selection.AddRange(range);

            Assert.IsTrue(contentChangedEventReceived);
        }
Example #2
0
 internal WindowUtils(nsIDOMWindowUtils windowUtils)
 {
     _windowUtils = windowUtils;
 }
 internal WindowUtils(nsIDOMWindowUtils windowUtils)
 {
     _windowUtils = windowUtils;
 }
Example #4
0
 internal WindowUtils(nsIDOMWindowUtils windowUtils)
 {
     _windowUtils = new ComPtr <nsIDOMWindowUtils>(windowUtils);
 }
Example #5
0
 public static WindowUtils Create(nsIDOMWindowUtils windowUtils)
 {
     return(new WindowUtils(windowUtils));
 }
Example #6
0
 internal WindowUtils(nsIDOMWindowUtils windowUtils)
 {
     _windowUtils = new ComPtr<nsIDOMWindowUtils>(windowUtils);
 }
Example #7
0
 public static WindowUtils Create(nsIDOMWindowUtils windowUtils)
 {
     return new WindowUtils(windowUtils);
 }
Example #8
0
 internal WindowUtils(nsIDOMWindowUtils windowUtils)
 {
     _windowUtils = new InstanceWrapper <nsIDOMWindowUtils>(windowUtils);
 }
Example #9
0
 public static WindowUtils Create(mozIDOMWindowProxy window, nsIDOMWindowUtils windowUtils)
 {
     return(new WindowUtils(window, windowUtils));
 }
Example #10
0
 internal WindowUtils(mozIDOMWindowProxy window, nsIDOMWindowUtils windowUtils)
 {
     _window      = window;
     _windowUtils = new ComPtr <nsIDOMWindowUtils>(windowUtils);
 }