Commit 9a176397 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Correct Ext.Base detection.

parent b4555d83
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@ module JsDuck
        elsif ext_define?(ast)
          cfg = object_expression_to_hash(ast["arguments"][1])

          cls[:extends] = make_extends(cfg["extend"])
          cls[:extends] = make_extends(cfg["extend"]) || "Ext.Base"
          cls[:requires] = make_requires(cfg["requires"])
          cls[:uses] = make_requires(cfg["uses"])
          cls[:alternateClassNames] = make_requires(cfg["alternateClassName"])
+7 −7
Original line number Diff line number Diff line
@@ -68,11 +68,9 @@ describe "JsDuck::Ast detects class with" do
        });
      EOS
    end
  end

  describe "no extends in" do
    it "Ext.define() with function argument" do
      detect(<<-EOS)[:extends].should == nil
      detect(<<-EOS)[:extends].should == "Ext.Base"
        /** */
        Ext.define('MyClass', function() {
        });
@@ -80,7 +78,7 @@ describe "JsDuck::Ast detects class with" do
    end

    it "Ext.define() with no extend: in config object" do
      detect(<<-EOS)[:extends].should == nil
      detect(<<-EOS)[:extends].should == "Ext.Base"
        /** */
        Ext.define('MyClass', {
            foo: 5,
@@ -88,13 +86,15 @@ describe "JsDuck::Ast detects class with" do
        });
      EOS
    end
  end

    it "Ext.define() with extend as number" do
  describe "no extends in" do
    it "plain variable assignment" do
      detect(<<-EOS)[:extends].should == nil
        /** */
        Ext.define('MyClass', {
        MyClass = {
            extend: 5
        });
        };
      EOS
    end
  end