Loading spec/aggregator_cfgs_and_properties_spec.rb +21 −20 Original line number Diff line number Diff line Loading @@ -74,11 +74,11 @@ describe JsDuck::Aggregator do describe "implicit @cfg" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg * Some documentation. */ foo: "asdf" foo: "asdf" }) EOS end it_should_behave_like "cfg" Loading @@ -89,10 +89,10 @@ describe JsDuck::Aggregator do describe "implicit @property" do before do @doc = parse(<<-EOS)[0] /** ({/** * Some documentation. */ foo: "asdf" foo: "asdf" }) EOS end it_should_behave_like "property" Loading @@ -103,11 +103,11 @@ describe JsDuck::Aggregator do describe "typeless @cfg" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg * Some documentation. */ foo: func(), foo: func() }) EOS end it_should_behave_like "cfg" Loading @@ -118,11 +118,11 @@ describe JsDuck::Aggregator do describe "typeless @property" do before do @doc = parse(<<-EOS)[0] /** ({/** * @property * Some documentation. */ foo: func(), foo: func() }) EOS end it_should_behave_like "property" Loading @@ -147,10 +147,10 @@ describe JsDuck::Aggregator do describe "@cfg with uppercase name" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg {String} Foo */ Foo: 12 Foo: 12 }) EOS end it_should_behave_like "cfg" Loading @@ -159,11 +159,11 @@ describe JsDuck::Aggregator do describe "@cfg with uppercase name after description" do before do @doc = parse(<<-EOS)[0] /** ({/** * Docs here * @cfg {String} Foo */ Foo: 12 Foo: 12 }) EOS end it_should_behave_like "cfg" Loading @@ -177,7 +177,7 @@ describe JsDuck::Aggregator do describe "@property with number in code" do before do @doc = parse("/** @property */ foo: 123")[0] @doc = parse("({ /** @property */ foo: 123 })")[0] @type = "Number" end it_should_behave_like "auto type" Loading @@ -185,7 +185,7 @@ describe JsDuck::Aggregator do describe "@property with regex in code" do before do @doc = parse("/** @property */ foo: /foo/i")[0] @doc = parse("({ /** @property */ foo: /foo/i })")[0] @type = "RegExp" end it_should_behave_like "auto type" Loading @@ -193,7 +193,7 @@ describe JsDuck::Aggregator do describe "@property with true in code" do before do @doc = parse("/** @property */ foo: true")[0] @doc = parse("({ /** @property */ foo: true })")[0] @type = "Boolean" end it_should_behave_like "auto type" Loading @@ -201,7 +201,7 @@ describe JsDuck::Aggregator do describe "@property with false in code" do before do @doc = parse("/** @property */ foo: false")[0] @doc = parse("({ /** @property */ foo: false })")[0] @type = "Boolean" end it_should_behave_like "auto type" Loading Loading @@ -241,11 +241,11 @@ describe JsDuck::Aggregator do describe "@type without @property" do before do @doc = parse(<<-EOS)[0] /** ({/** * @type String * Some documentation. */ MY_CONSTANT: true, MY_CONSTANT: true }) EOS end it_should_behave_like "property" Loading @@ -262,7 +262,7 @@ describe JsDuck::Aggregator do * @property * Some documentation. */ this.foo = ""; this.foo = "" EOS end it_should_behave_like "property" Loading @@ -273,10 +273,11 @@ describe JsDuck::Aggregator do describe "comma-first style" do before do @doc = parse(<<-EOS)[0] ({ blah: 100 /** * Some documentation. */ ,foo: "" ,foo: "" }) EOS end it_should_behave_like "property" Loading spec/aggregator_default_values_spec.rb +27 −27 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ describe JsDuck::Aggregator do /** * @param {Number} foo (optional) Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading @@ -41,7 +41,7 @@ describe JsDuck::Aggregator do /** * @param {Number} foo (Optional) Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading @@ -53,7 +53,7 @@ describe JsDuck::Aggregator do /** * @param {Number} foo optional Something */ function foo() { function foo() {} EOS end it "doesn't make parameter optional" do Loading @@ -67,7 +67,7 @@ describe JsDuck::Aggregator do /** * @param {Number} foo Something (optional) */ function foo() { function foo() {} EOS end it "doesn't make parameter optional" do Loading @@ -81,7 +81,7 @@ describe JsDuck::Aggregator do /** * @param {Number} [foo] Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading @@ -93,7 +93,7 @@ describe JsDuck::Aggregator do /** * @param {Number} [foo=42] Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading @@ -108,7 +108,7 @@ describe JsDuck::Aggregator do /** * @param {Number} [foo="Hello, my [dear]!"] Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading Loading @@ -263,10 +263,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: 18 foo: 18 }) EOS end it "detects the default value" do Loading @@ -277,10 +277,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default string value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: "Hello" foo: "Hello" }) EOS end it "detects the default value" do Loading @@ -291,10 +291,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default regex value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: /[a-z]/ foo: /[a-z]/ }) EOS end it "detects the default value" do Loading @@ -305,10 +305,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default array value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: [1, 2, 3] foo: [1, 2, 3] }) EOS end it "detects the default value" do Loading @@ -319,10 +319,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default object value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: {foo: 3, bar: "2"} foo: {foo: 3, bar: "2"} }) EOS end it "detects the default value" do Loading @@ -333,10 +333,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit string value starting with Ext.baseCSSPrefix" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: Ext.baseCSSPrefix + "foo" foo: Ext.baseCSSPrefix + "foo" }) EOS end it "replaces Ext.baseCSSPrefix with 'x-'" do Loading @@ -347,10 +347,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit number value given as expression" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg {Number} foo */ foo: 5 + 5 foo: 5 + 5 }) EOS end it "doesn't get the default value from code" do Loading @@ -361,10 +361,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit array value with chained method" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg {Array} foo */ foo: [1, 2, 3].compact() foo: [1, 2, 3].compact() }) EOS end it "doesn't get the default value from code" do Loading @@ -375,10 +375,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit name followed by code field with another name" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo */ bar: true bar: true }) EOS end it "doesn't get the default value from code" do Loading @@ -392,10 +392,10 @@ describe JsDuck::Aggregator do describe "cfg without implicit name followed by code" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg */ bar: true bar: true }) EOS end it "gets default value from code" do Loading spec/aggregator_methods_and_events_spec.rb +7 −7 Original line number Diff line number Diff line Loading @@ -111,14 +111,14 @@ describe JsDuck::Aggregator do describe "function-literal in object-literal" do before do @doc = parse("/** Some function */ foo: function() {}")[0] @doc = parse("({ /** Some function */ foo: function() {} })")[0] end it_should_behave_like "method documentation" end describe "function-literal in object-literal-string" do before do @doc = parse("/** Some function */ 'foo': function() {}")[0] @doc = parse("({ /** Some function */ 'foo': function() {} })")[0] end it_should_behave_like "method documentation" end Loading @@ -132,21 +132,21 @@ describe JsDuck::Aggregator do describe "function-literal in comma-first style" do before do @doc = parse("/** Some function */ , foo: function() {}")[0] @doc = parse("({ blah: 7 /** Some function */ , foo: function() {} })")[0] end it_should_behave_like "method documentation" end describe "Ext.emptyFn in object-literal" do before do @doc = parse("/** Some function */ foo: Ext.emptyFn")[0] @doc = parse("({ /** Some function */ foo: Ext.emptyFn })")[0] end it_should_behave_like "method documentation" end describe "anonymous function" do before do @doc = parse("/** Some function */ function() {}")[0] @doc = parse("( /** Some function */ function() {} )")[0] end it "detects method" do Loading Loading @@ -398,11 +398,11 @@ describe JsDuck::Aggregator do describe "implicit event name as object property" do before do @doc = parse(<<-EOS)[0] /** ({/** * @event * Fires when needed. */ mousedown: true, mousedown: true }) EOS end it_should_behave_like "event documentation" Loading Loading
spec/aggregator_cfgs_and_properties_spec.rb +21 −20 Original line number Diff line number Diff line Loading @@ -74,11 +74,11 @@ describe JsDuck::Aggregator do describe "implicit @cfg" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg * Some documentation. */ foo: "asdf" foo: "asdf" }) EOS end it_should_behave_like "cfg" Loading @@ -89,10 +89,10 @@ describe JsDuck::Aggregator do describe "implicit @property" do before do @doc = parse(<<-EOS)[0] /** ({/** * Some documentation. */ foo: "asdf" foo: "asdf" }) EOS end it_should_behave_like "property" Loading @@ -103,11 +103,11 @@ describe JsDuck::Aggregator do describe "typeless @cfg" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg * Some documentation. */ foo: func(), foo: func() }) EOS end it_should_behave_like "cfg" Loading @@ -118,11 +118,11 @@ describe JsDuck::Aggregator do describe "typeless @property" do before do @doc = parse(<<-EOS)[0] /** ({/** * @property * Some documentation. */ foo: func(), foo: func() }) EOS end it_should_behave_like "property" Loading @@ -147,10 +147,10 @@ describe JsDuck::Aggregator do describe "@cfg with uppercase name" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg {String} Foo */ Foo: 12 Foo: 12 }) EOS end it_should_behave_like "cfg" Loading @@ -159,11 +159,11 @@ describe JsDuck::Aggregator do describe "@cfg with uppercase name after description" do before do @doc = parse(<<-EOS)[0] /** ({/** * Docs here * @cfg {String} Foo */ Foo: 12 Foo: 12 }) EOS end it_should_behave_like "cfg" Loading @@ -177,7 +177,7 @@ describe JsDuck::Aggregator do describe "@property with number in code" do before do @doc = parse("/** @property */ foo: 123")[0] @doc = parse("({ /** @property */ foo: 123 })")[0] @type = "Number" end it_should_behave_like "auto type" Loading @@ -185,7 +185,7 @@ describe JsDuck::Aggregator do describe "@property with regex in code" do before do @doc = parse("/** @property */ foo: /foo/i")[0] @doc = parse("({ /** @property */ foo: /foo/i })")[0] @type = "RegExp" end it_should_behave_like "auto type" Loading @@ -193,7 +193,7 @@ describe JsDuck::Aggregator do describe "@property with true in code" do before do @doc = parse("/** @property */ foo: true")[0] @doc = parse("({ /** @property */ foo: true })")[0] @type = "Boolean" end it_should_behave_like "auto type" Loading @@ -201,7 +201,7 @@ describe JsDuck::Aggregator do describe "@property with false in code" do before do @doc = parse("/** @property */ foo: false")[0] @doc = parse("({ /** @property */ foo: false })")[0] @type = "Boolean" end it_should_behave_like "auto type" Loading Loading @@ -241,11 +241,11 @@ describe JsDuck::Aggregator do describe "@type without @property" do before do @doc = parse(<<-EOS)[0] /** ({/** * @type String * Some documentation. */ MY_CONSTANT: true, MY_CONSTANT: true }) EOS end it_should_behave_like "property" Loading @@ -262,7 +262,7 @@ describe JsDuck::Aggregator do * @property * Some documentation. */ this.foo = ""; this.foo = "" EOS end it_should_behave_like "property" Loading @@ -273,10 +273,11 @@ describe JsDuck::Aggregator do describe "comma-first style" do before do @doc = parse(<<-EOS)[0] ({ blah: 100 /** * Some documentation. */ ,foo: "" ,foo: "" }) EOS end it_should_behave_like "property" Loading
spec/aggregator_default_values_spec.rb +27 −27 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ describe JsDuck::Aggregator do /** * @param {Number} foo (optional) Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading @@ -41,7 +41,7 @@ describe JsDuck::Aggregator do /** * @param {Number} foo (Optional) Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading @@ -53,7 +53,7 @@ describe JsDuck::Aggregator do /** * @param {Number} foo optional Something */ function foo() { function foo() {} EOS end it "doesn't make parameter optional" do Loading @@ -67,7 +67,7 @@ describe JsDuck::Aggregator do /** * @param {Number} foo Something (optional) */ function foo() { function foo() {} EOS end it "doesn't make parameter optional" do Loading @@ -81,7 +81,7 @@ describe JsDuck::Aggregator do /** * @param {Number} [foo] Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading @@ -93,7 +93,7 @@ describe JsDuck::Aggregator do /** * @param {Number} [foo=42] Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading @@ -108,7 +108,7 @@ describe JsDuck::Aggregator do /** * @param {Number} [foo="Hello, my [dear]!"] Something */ function foo() { function foo() {} EOS end it_should_behave_like "optional parameter" Loading Loading @@ -263,10 +263,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: 18 foo: 18 }) EOS end it "detects the default value" do Loading @@ -277,10 +277,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default string value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: "Hello" foo: "Hello" }) EOS end it "detects the default value" do Loading @@ -291,10 +291,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default regex value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: /[a-z]/ foo: /[a-z]/ }) EOS end it "detects the default value" do Loading @@ -305,10 +305,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default array value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: [1, 2, 3] foo: [1, 2, 3] }) EOS end it "detects the default value" do Loading @@ -319,10 +319,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit default object value" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: {foo: 3, bar: "2"} foo: {foo: 3, bar: "2"} }) EOS end it "detects the default value" do Loading @@ -333,10 +333,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit string value starting with Ext.baseCSSPrefix" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo Something */ foo: Ext.baseCSSPrefix + "foo" foo: Ext.baseCSSPrefix + "foo" }) EOS end it "replaces Ext.baseCSSPrefix with 'x-'" do Loading @@ -347,10 +347,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit number value given as expression" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg {Number} foo */ foo: 5 + 5 foo: 5 + 5 }) EOS end it "doesn't get the default value from code" do Loading @@ -361,10 +361,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit array value with chained method" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg {Array} foo */ foo: [1, 2, 3].compact() foo: [1, 2, 3].compact() }) EOS end it "doesn't get the default value from code" do Loading @@ -375,10 +375,10 @@ describe JsDuck::Aggregator do describe "cfg with implicit name followed by code field with another name" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg foo */ bar: true bar: true }) EOS end it "doesn't get the default value from code" do Loading @@ -392,10 +392,10 @@ describe JsDuck::Aggregator do describe "cfg without implicit name followed by code" do before do @doc = parse(<<-EOS)[0] /** ({/** * @cfg */ bar: true bar: true }) EOS end it "gets default value from code" do Loading
spec/aggregator_methods_and_events_spec.rb +7 −7 Original line number Diff line number Diff line Loading @@ -111,14 +111,14 @@ describe JsDuck::Aggregator do describe "function-literal in object-literal" do before do @doc = parse("/** Some function */ foo: function() {}")[0] @doc = parse("({ /** Some function */ foo: function() {} })")[0] end it_should_behave_like "method documentation" end describe "function-literal in object-literal-string" do before do @doc = parse("/** Some function */ 'foo': function() {}")[0] @doc = parse("({ /** Some function */ 'foo': function() {} })")[0] end it_should_behave_like "method documentation" end Loading @@ -132,21 +132,21 @@ describe JsDuck::Aggregator do describe "function-literal in comma-first style" do before do @doc = parse("/** Some function */ , foo: function() {}")[0] @doc = parse("({ blah: 7 /** Some function */ , foo: function() {} })")[0] end it_should_behave_like "method documentation" end describe "Ext.emptyFn in object-literal" do before do @doc = parse("/** Some function */ foo: Ext.emptyFn")[0] @doc = parse("({ /** Some function */ foo: Ext.emptyFn })")[0] end it_should_behave_like "method documentation" end describe "anonymous function" do before do @doc = parse("/** Some function */ function() {}")[0] @doc = parse("( /** Some function */ function() {} )")[0] end it "detects method" do Loading Loading @@ -398,11 +398,11 @@ describe JsDuck::Aggregator do describe "implicit event name as object property" do before do @doc = parse(<<-EOS)[0] /** ({/** * @event * Fires when needed. */ mousedown: true, mousedown: true }) EOS end it_should_behave_like "event documentation" Loading