Commit 9698facd authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Extra tests for @links to static members.

parent 7d2f17d9
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -11,7 +11,10 @@ describe JsDuck::DocFormatter do
        :name => "Context",
        :members => {
          :method => [{:name => "bar", :tagname => :method}]
        }
        },
        :statics => {
          :method => [{:name => "id", :tagname => :method}],
        },
      }),
      JsDuck::Class.new({
        :name => 'Ext.Msg'
@@ -21,6 +24,9 @@ describe JsDuck::DocFormatter do
        :members => {
          :cfg => [{:name => "bar", :tagname => :cfg}],
        },
        :statics => {
          :method => [{:name => "id", :tagname => :method}],
        },
        :alternateClassNames => ["FooBar"]
      }),
    ])
@@ -40,11 +46,21 @@ describe JsDuck::DocFormatter do
        'Look at <a href="Foo#cfg-bar">Foo.bar</a>'
    end

    it "replaces {@link Foo#id} with link to static class member" do
      @formatter.replace("Look at {@link Foo#id}").should ==
        'Look at <a href="Foo#method-id">Foo.id</a>'
    end

    it "uses context to replace {@link #bar} with link to class member" do
      @formatter.replace("Look at {@link #bar}").should ==
        'Look at <a href="Context#method-bar">bar</a>'
    end

    it "uses context to replace {@link #id} with link to static class member" do
      @formatter.replace("Look at {@link #id}").should ==
        'Look at <a href="Context#method-id">id</a>'
    end

    it "allows use of custom link text" do
      @formatter.replace("Look at {@link Foo link text}").should ==
        'Look at <a href="Foo">link text</a>'