Пример #1
0
        /// <summary>
        /// Checks if the element is open.
        /// </summary>
        public virtual bool IsExpanded()
        {
            var isExpanded = WrappedElement.Is(animationData.IsOpenSelector) &&
                             !IsCurrentlyAnimating();

            return(isExpanded);
        }
Пример #2
0
        /// <summary>
        /// If overriding don't forget to call base.Load() or make sure to
        /// assign the WrappedElement.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="InvalidElementStateException">Expected the class " +
        ///                     "'btn-group' to be present on the WrappedElement.</exception>
        public override ILoadableComponent Load()
        {
            base.Load();

            // Verify this is a button group.
            if (!WrappedElement.Is(By.CssSelector(".btn-group")))
            {
                throw new InvalidElementStateException("Expected the class " +
                                                       "'btn-group' to be present on the WrappedElement.");
            }

            // Check if split or single.
            IsSplitButton = WrappedElement
                            .FindElements(By.CssSelector(".dropdown-toggle-split"))
                            .Any();

            return(this);
        }
Пример #3
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)));
        }
Пример #4
0
 private bool IsExpanded()
 {
     return(WrappedElement.Is(By.CssSelector(".open")));
 }