Commit eaf86f82 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Make event name detection work.

parent c820ad26
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -81,7 +81,11 @@ module JsDuck
      elsif exp && ident?(exp)
        make_property(to_s(exp))

      # "foo";
      # "foo"  (inside some expression)
      elsif string?(ast)
        make_property(to_value(ast))

      # "foo";  (as a statement of it's own)
      elsif exp && string?(exp)
        make_property(to_value(exp))

+9 −0
Original line number Diff line number Diff line
@@ -49,6 +49,15 @@ describe "JsDuck::Ast detects property with" do
    it "lonely string" do
      detect("/** */ 'foo';")[:name].should == "foo"
    end

    it "string as function argument" do
      detect(<<-EOS)[:name].should == "foo"
        this.addEvents(
            /** */
            "foo"
        );
      EOS
    end
  end

  describe "type in var initialized with" do