Geb
  1. Geb
  2. GEB-97

Return type of Navigator#classes() should be Set

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Not A Bug
    • Affects Version/s: 0.6.0
    • Fix Version/s: 0.6.1
    • Component/s: Core, Manual/Documentation
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Ref: http://markmail.org/thread/atmnaqk2kqthecux

      At http://www.gebish.org/manual/current/navigator.html#accessing_tag_name_attributes_text_and_classes we have:

      """
      $("p").classes() == ["a", "para"]
      """

      This implies that classes() returns a List. As far as I can see, it is actually a java.util.HashSet.

      For example, this had me briefly flummoxed:

      """
      resultLink.with

      { l -> assert l.size() > 0 assert l.parent().classes() == ['entry-title'] }

      """

      Gives:


      C:\DEVELOPMENT\Geb>groovy Transentia.geb
      Caught: Assertion failed:

      assert l.parent().classes() == ['entry-title']

           
          false
        [entry-title]
      [<h3 class="entry-title">]
      [<a href="http://wordpress.transentia.com.au/wordpress/2011/07/10/groovyg
      rails-live-snippets/">]

      at Transentia$_run_closure2_closure4.doCall(Transentia.geb:40)
      at Transentia$_run_closure2.doCall(Transentia.geb:37)
      at Transentia$_run_closure2.doCall(Transentia.geb)
      at geb.Browser.drive(Browser.groovy:538)
      at geb.Browser.drive(Browser.groovy:508)
      at Transentia.run(Transentia.geb:14)

      While:

      """
      resultLink.with

      { l -> assert l.size() > 0 assert l.parent().classes().contains('entry-title') assert l.parent().classes() == ['entry-title'] as Set }

      """

      Works OK.

      """
      println l.parent().classes().dump()
      """

      Gives:


      <java.util.HashSet@7b41a13d map=[entry-title:java.lang.Object@319762c8]>

      Maybe the doco needs a quick tweak?

        Issue Links

          Activity

          Hide
          Luke Daley added a comment -

          I'm going to change this to explicitly return a sorted list, and have opened a new issue for this which is linked to this one.

          Show
          Luke Daley added a comment - I'm going to change this to explicitly return a sorted list, and have opened a new issue for this which is linked to this one.

            People

            • Assignee:
              Luke Daley
              Reporter:
              alpheratz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: