Loading spec/aggregator_classes_spec.rb +0 −52 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ describe JsDuck::Aggregator do * @alternateClassNames AltClass * Some documentation. * @singleton * @xtype nicely */ EOS end Loading @@ -49,9 +48,6 @@ describe JsDuck::Aggregator do it "detects singleton" do @doc[:singleton].should == true end it "detects xtype" do @doc[:xtypes].should == {"widget" => ["nicely"]} end end describe "class @tag aliases" do Loading Loading @@ -115,24 +111,6 @@ describe JsDuck::Aggregator do end end describe "class with multiple @xtypes" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @xtype foo * @xtype bar * Some documentation. */ EOS end it_should_behave_like "class" it "collects all xtypes together" do @doc[:xtypes].should == {"widget" => ["foo", "bar"]} end end describe "function after doc-comment" do before do @doc = parse("/** */ function MyClass() {}")[0] Loading Loading @@ -195,9 +173,6 @@ describe JsDuck::Aggregator do it "detects implied alternateClassNames" do @doc[:alternateClassNames].should == ["JustClass"] end it "detects implied xtype" do @doc[:xtypes].should == {"widget" => ["foo"]} end it "detects implied singleton" do @doc[:singleton].should == true end Loading @@ -219,7 +194,6 @@ describe JsDuck::Aggregator do obs: 'Ext.util.Observable', bar: 'Foo.Bar' }, alias: 'widget.foo', alternateClassName: 'JustClass', singleton: true, requires: ['ClassA', 'ClassB'], Loading Loading @@ -250,7 +224,6 @@ describe JsDuck::Aggregator do extend: 'Your.Class', uses: ['ClassC'], conf: {foo: 10}, alias: ['widget.foo'], singleton: true, alternateClassName: ['JustClass'], stuff: ["foo", "bar"], Loading Loading @@ -333,25 +306,6 @@ describe JsDuck::Aggregator do end end describe "@xtype after @constructor" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * Comment here. * @constructor * This constructs the class * @xtype nicely */ EOS end it_should_behave_like "class" it "detects xtype" do @doc[:xtypes].should == {"widget" => ["nicely"]} end end describe "class with @markdown" do before do @doc = parse(<<-EOS)[0] Loading Loading @@ -461,7 +415,6 @@ describe JsDuck::Aggregator do * @mixins Mix1 * @alternateClassNames AltClassic * Second description. * @xtype xfoo * @private * @cfg c2 */ Loading @@ -474,7 +427,6 @@ describe JsDuck::Aggregator do * @mixins Mix2 * @singleton * Third description. * @xtype xxxfoo * @cfg c3 */ /** @method fun3 */ Loading Loading @@ -503,10 +455,6 @@ describe JsDuck::Aggregator do @classes[0][:private].should == true end it "combines all @xtypes" do @classes[0][:xtypes]["widget"].length.should == 2 end it "combines all configs" do @classes[0][:members][:cfg].length.should == 3 end Loading spec/aggregator_xtypes_spec.rb 0 → 100644 +136 −0 Original line number Diff line number Diff line require "jsduck/aggregator" require "jsduck/source_file" describe JsDuck::Aggregator do def parse(string) agr = JsDuck::Aggregator.new agr.aggregate(JsDuck::SourceFile.new(string)) agr.result end shared_examples_for "single xtype" do it "detects xtype" do @doc[:xtypes].should == {"widget" => ["foo"]} end end shared_examples_for "multiple xtypes" do it "collects all xtypes together" do @doc[:xtypes].should == {"widget" => ["foo", "bar"]} end end describe "class with @xtype" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @xtype foo */ EOS end it_should_behave_like "single xtype" end describe "@xtype after @constructor" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * Comment here. * @constructor * This constructs the class * @xtype foo */ EOS end it_should_behave_like "single xtype" end describe "class with multiple @xtypes" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @xtype foo * @xtype bar * Some documentation. */ EOS end it_should_behave_like "multiple xtypes" end describe "Ext.define() with simple alias" do before do @doc = parse(<<-EOS)[0] /** */ Ext.define('MyClass', { alias: 'widget.foo' }); EOS end it_should_behave_like "single xtype" end describe "Ext.define() with @xtype overriding alias" do before do @doc = parse(<<-EOS)[0] /** * @xtype foo */ Ext.define('MyClass', { alias: 'widget.xxx' }); EOS end it_should_behave_like "single xtype" end describe "Ext.define() with array of aliases" do before do @doc = parse(<<-EOS)[0] /** */ Ext.define('MyClass', { alias: ['widget.foo', 'widget.bar'] }); EOS end it_should_behave_like "multiple xtypes" end describe "Ext.define() with different kinds of aliases" do before do @doc = parse(<<-EOS)[0] /** */ Ext.define('MyClass', { alias: ['store.json', 'store.ajax', 'component.myclass'] }); EOS end it "collects all aliases together" do @doc[:xtypes].should == {"store" => ["json", "ajax"], "component" => ["myclass"]} end end describe "one class many times" do before do @doc = parse(<<-EOS)[0] /** * @class Foo */ /** * @class Foo * @xtype foo */ /** * @class Foo * @xtype bar */ EOS end it_should_behave_like "multiple xtypes" end end Loading
spec/aggregator_classes_spec.rb +0 −52 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ describe JsDuck::Aggregator do * @alternateClassNames AltClass * Some documentation. * @singleton * @xtype nicely */ EOS end Loading @@ -49,9 +48,6 @@ describe JsDuck::Aggregator do it "detects singleton" do @doc[:singleton].should == true end it "detects xtype" do @doc[:xtypes].should == {"widget" => ["nicely"]} end end describe "class @tag aliases" do Loading Loading @@ -115,24 +111,6 @@ describe JsDuck::Aggregator do end end describe "class with multiple @xtypes" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @xtype foo * @xtype bar * Some documentation. */ EOS end it_should_behave_like "class" it "collects all xtypes together" do @doc[:xtypes].should == {"widget" => ["foo", "bar"]} end end describe "function after doc-comment" do before do @doc = parse("/** */ function MyClass() {}")[0] Loading Loading @@ -195,9 +173,6 @@ describe JsDuck::Aggregator do it "detects implied alternateClassNames" do @doc[:alternateClassNames].should == ["JustClass"] end it "detects implied xtype" do @doc[:xtypes].should == {"widget" => ["foo"]} end it "detects implied singleton" do @doc[:singleton].should == true end Loading @@ -219,7 +194,6 @@ describe JsDuck::Aggregator do obs: 'Ext.util.Observable', bar: 'Foo.Bar' }, alias: 'widget.foo', alternateClassName: 'JustClass', singleton: true, requires: ['ClassA', 'ClassB'], Loading Loading @@ -250,7 +224,6 @@ describe JsDuck::Aggregator do extend: 'Your.Class', uses: ['ClassC'], conf: {foo: 10}, alias: ['widget.foo'], singleton: true, alternateClassName: ['JustClass'], stuff: ["foo", "bar"], Loading Loading @@ -333,25 +306,6 @@ describe JsDuck::Aggregator do end end describe "@xtype after @constructor" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * Comment here. * @constructor * This constructs the class * @xtype nicely */ EOS end it_should_behave_like "class" it "detects xtype" do @doc[:xtypes].should == {"widget" => ["nicely"]} end end describe "class with @markdown" do before do @doc = parse(<<-EOS)[0] Loading Loading @@ -461,7 +415,6 @@ describe JsDuck::Aggregator do * @mixins Mix1 * @alternateClassNames AltClassic * Second description. * @xtype xfoo * @private * @cfg c2 */ Loading @@ -474,7 +427,6 @@ describe JsDuck::Aggregator do * @mixins Mix2 * @singleton * Third description. * @xtype xxxfoo * @cfg c3 */ /** @method fun3 */ Loading Loading @@ -503,10 +455,6 @@ describe JsDuck::Aggregator do @classes[0][:private].should == true end it "combines all @xtypes" do @classes[0][:xtypes]["widget"].length.should == 2 end it "combines all configs" do @classes[0][:members][:cfg].length.should == 3 end Loading
spec/aggregator_xtypes_spec.rb 0 → 100644 +136 −0 Original line number Diff line number Diff line require "jsduck/aggregator" require "jsduck/source_file" describe JsDuck::Aggregator do def parse(string) agr = JsDuck::Aggregator.new agr.aggregate(JsDuck::SourceFile.new(string)) agr.result end shared_examples_for "single xtype" do it "detects xtype" do @doc[:xtypes].should == {"widget" => ["foo"]} end end shared_examples_for "multiple xtypes" do it "collects all xtypes together" do @doc[:xtypes].should == {"widget" => ["foo", "bar"]} end end describe "class with @xtype" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @xtype foo */ EOS end it_should_behave_like "single xtype" end describe "@xtype after @constructor" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * Comment here. * @constructor * This constructs the class * @xtype foo */ EOS end it_should_behave_like "single xtype" end describe "class with multiple @xtypes" do before do @doc = parse(<<-EOS)[0] /** * @class MyClass * @xtype foo * @xtype bar * Some documentation. */ EOS end it_should_behave_like "multiple xtypes" end describe "Ext.define() with simple alias" do before do @doc = parse(<<-EOS)[0] /** */ Ext.define('MyClass', { alias: 'widget.foo' }); EOS end it_should_behave_like "single xtype" end describe "Ext.define() with @xtype overriding alias" do before do @doc = parse(<<-EOS)[0] /** * @xtype foo */ Ext.define('MyClass', { alias: 'widget.xxx' }); EOS end it_should_behave_like "single xtype" end describe "Ext.define() with array of aliases" do before do @doc = parse(<<-EOS)[0] /** */ Ext.define('MyClass', { alias: ['widget.foo', 'widget.bar'] }); EOS end it_should_behave_like "multiple xtypes" end describe "Ext.define() with different kinds of aliases" do before do @doc = parse(<<-EOS)[0] /** */ Ext.define('MyClass', { alias: ['store.json', 'store.ajax', 'component.myclass'] }); EOS end it "collects all aliases together" do @doc[:xtypes].should == {"store" => ["json", "ajax"], "component" => ["myclass"]} end end describe "one class many times" do before do @doc = parse(<<-EOS)[0] /** * @class Foo */ /** * @class Foo * @xtype foo */ /** * @class Foo * @xtype bar */ EOS end it_should_behave_like "multiple xtypes" end end