Esempio n. 1
0
        /// <summary>
        /// Determines whether the <c>WrappedElement</c> is animating.
        /// </summary>
        /// <param name="animationData">The animation data.</param>
        /// <returns>
        ///   <c>true</c> if [is currently animating] [the specified animation data]; otherwise, <c>false</c>.
        /// </returns>
        protected virtual bool IsCurrentlyAnimating(
            CollapsableOptions animationData = null)
        {
            var opts = animationData ?? this.animationData;

            // Check that animations are enabled and that there are animation
            // selectors.
            if (!opts.AnimationsEnabled ||
                (opts.AnimationSelectors?.Any() ?? false))
            {
                return(false);
            }

            // Check if any of the animation selectors match the wrapped
            // element.
            return(opts
                   .AnimationSelectors
                   .Any(s => WrappedElement.Is(s)));
        }
Esempio n. 2
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="animationData"></param>
        /// <param name="driver"></param>
        /// <param name="parent"></param>
        public CollapsableComponent(CollapsableOptions animationData,
                                    IWebDriver driver,
                                    T parent)
            : base(animationData.CollapsableContainerSelector, driver, parent)
        {
            if (driver == null)
            {
                throw new ArgumentNullException(nameof(driver));
            }
            else if (animationData == null)
            {
                throw new ArgumentNullException(nameof(animationData));
            }
            else if (!animationData.AnimationsEnabled && !animationData.AnimationSelectors.Any())
            {
                throw new ArgumentException("If animations are enabled animation selectors cannot be null/empty.", nameof(animationData));
            }
            else if (animationData.IsOpenSelector == null)
            {
                throw new ArgumentException("The IsOpenSelector property is required.", nameof(animationData));
            }

            this.animationData = animationData;
        }
Esempio n. 3
0
 /// <summary>
 /// Waits for animation end.
 /// </summary>
 /// <param name="animationData">The animation data.</param>
 protected virtual void WaitForAnimationEnd(
     CollapsableOptions animationData = null)
 {
     WrappedElement.WaitForEvent(EventHiddenCollapse);
 }
Esempio n. 4
0
 /// <summary>
 /// Waits for animation start.
 /// </summary>
 /// <param name="animationData">The animation data.</param>
 protected virtual void WaitForAnimationStart(
     CollapsableOptions animationData = null)
 {
     WrappedElement.WaitForEvent(EventShowCollapse);
 }