Commit 747edb79 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Covered the case of long.prototype.chains.

parent ed8b352e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -222,6 +222,16 @@ module JsDuck
            lex.look(:string, ":", "function") then
          # name: function(){
          doc.set_default(:function, {:name => lex.next})
        elsif lex.look(:keyword, ".") then
          # some.long.prototype.chain = function() {
          lex.next
          while lex.look(".", :keyword) do
            lex.next
            name = lex.next
            if lex.look("=", "function") then
              doc.set_default(:function, {:name => name})
            end
          end
        end
        docs << doc
      else
+10 −0
Original line number Diff line number Diff line
@@ -99,6 +99,16 @@ foo: function() {
    assert_equal("foo", docs[0][:function][:name])
  end

  def test_function_in_prototype
    docs = JsDuck.parse("
/**
 */
Some.Long.prototype.foo = function() {
}
")
    assert_equal("foo", docs[0][:function][:name])
  end

  def test_function_private
    docs = JsDuck.parse("
// no doc-comment for this function