TextArea.cs :  » Web-Testing » IeUnit-web-testing-framework » QuickFocus » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Web Testing » IeUnit web testing framework 
IeUnit web testing framework » QuickFocus » TextArea.cs
/// <copyright from="2004" to="2006" company="VisuMap Technologies Inc.">
///   Copyright (C) VisuMap Technologies Inc.
/// 
///   Permission to use, copy, modify, distribute and sell this 
///   software and its documentation for any purpose is hereby 
///   granted without fee, provided that the above copyright notice 
///   appear in all copies and that both that copyright notice and 
///   this permission notice appear in supporting documentation. 
///   VisuMap Technologies Company makes no representations about the 
///   suitability of this software for any purpose. It is provided 
///   "as is" without explicit or implied warranty. 
/// </copyright>
using System;
using mshtml;
using System.Collections;


namespace QuickFocus{
    /// <summary>
    /// Summary description for TextField.
    /// </summary>
    public class TextArea : PageElement {
        private TextArea(IHTMLElement e) : base(e) {
        }

        public static TextArea AsTextArea(IHTMLElement e) {
            IHTMLTextAreaElement e2 = e as IHTMLTextAreaElement;
            if (e2 != null) {
                return new TextArea(e);
            }
            return null;
        }

        private int GetIndex() {
            int idx = -1;
            IHTMLElementCollection eList = MainForm.SelectedDoc.all.tags("TEXTAREA") as IHTMLElementCollection;
            IEnumerator it = eList.GetEnumerator();
            while ( it.MoveNext() ) {
                idx++;
                if ( this.e.Equals(it.Current) ) {
                    break;
                }
            }
            return idx;
        }

        private string Value {
            get { 
                string v = (e as IHTMLTextAreaElement).value; 
                return (v==null) ? "" : v;
            }
        }

        public override ArrayList ActionSnipList() {
            
            //Notice: an text input element can have both id and name, both can
            //can be access through the hash table document.all().

            if ( (e.id != null) && IsUnique(e.id) ) {
                AddSnip("_.setTextArea(\"" + e.id + "\", \"" + EscapeString(this.Value) + "\");");
            }

            IHTMLTextAreaElement e2 = e as IHTMLTextAreaElement;
            if ( (e2.name != null) && IsUnique(e2.name) ) {
                AddSnip("_.setTextArea(\"" + e2.name + "\", \"" + EscapeString(this.Value) + "\");");
            }

            AddSnip("_.setTextArea(" + this.GetIndex() + ",\"" + EscapeString(this.Value) + "\");");

            return snipList;
        }


        public override ArrayList AssertSnipList() {
            AssertObjWithId();

            IHTMLTextAreaElement e2 = e as IHTMLTextAreaElement;
            if ( (e2.name != null) && IsUnique(e2.name) ) {
                AddSnip("_.assertEquals(\"" + EscapeString(e2.value) + "\", _.findTextArea(\"" + e2.name + "\").value);");
                AddSnip("_.assertNotNull(_.findTextArea(\"" + e2.name + "\"));");
            }

            return snipList;
        }    
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.