cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omefire <...@git.apache.org>
Subject [GitHub] cordova-lib pull request: Deprecate the old feature syntax from co...
Date Tue, 10 Mar 2015 02:47:37 GMT
Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/182#discussion_r26095614
  
    --- Diff: cordova-lib/spec-cordova/ConfigParser.spec.js ---
    @@ -114,78 +114,94 @@ describe('config.xml parser', function () {
                     expect(cfg.getPlatformPreference('orientation', 'foobar')).toEqual('');
                 });
             });
    -        describe('feature',function(){
    -            it('should read feature id list', function() {
    +        describe('plugin',function(){
    +            it('should read plugin id list', function() {
                    var expectedList = [
                        'org.apache.cordova.featurewithvars',
                        'org.apache.cordova.featurewithurl',
                        'org.apache.cordova.featurewithversion',
                        'org.apache.cordova.featurewithurlandversion',
    -                   'org.apache.cordova.justafeature'
    +                   'org.apache.cordova.justafeature',
    +                   'org.apache.cordova.legacyfeature'
                    ];
    -               var list = cfg.getFeatureIdList();
    +               var list = cfg.getPluginIdList();
                    expect(list.length).toEqual(expectedList.length);
    -               expectedList.forEach(function(feature){
    -                   expect(list).toContain(feature);
    +               expectedList.forEach(function(plugin){
    +               expect(list).toContain(plugin);
                    });
                 });
    -            it('should read feature given id', function(){
    -                var feature = cfg.getFeature('org.apache.cordova.justafeature');
    -                expect(feature).toBeDefined();
    -                expect(feature.name).toEqual('A simple feature');
    -                expect(feature.id).toEqual('org.apache.cordova.justafeature');
    -                expect(feature.params).toBeDefined();
    -                expect(feature.params.id).toBeDefined();
    -                expect(feature.params.id).toEqual('org.apache.cordova.justafeature');
    -            });
    -            it('should not read feature given undefined id', function(){
    -                var feature = cfg.getFeature('org.apache.cordova.undefinedfeature');
    -                expect(feature).not.toBeDefined();
    -            });
    -            it('should read feature with url and set \'url\' param', function(){
    -                var feature = cfg.getFeature('org.apache.cordova.featurewithurl');
    -                expect(feature.url).toEqual('http://cordova.apache.org/featurewithurl');
    -                expect(feature.params).toBeDefined();
    -                expect(feature.params.url).toBeDefined();
    -                expect(feature.params.url).toEqual('http://cordova.apache.org/featurewithurl');
    -            });
    -            it('should read feature with version and set \'version\' param', function(){
    -                var feature = cfg.getFeature('org.apache.cordova.featurewithversion');
    -                expect(feature.version).toEqual('1.1.1');
    -                expect(feature.params).toBeDefined();
    -                expect(feature.params.version).toBeDefined();
    -                expect(feature.params.version).toEqual('1.1.1');
    -            });
    -            it('should read feature variables', function () {
    -                var feature = cfg.getFeature('org.apache.cordova.featurewithvars');
    -                expect(feature.variables).toBeDefined();
    -                expect(feature.variables.var).toBeDefined();
    -                expect(feature.variables.var).toEqual('varvalue');
    -            });
    -            it('should allow adding a new feature', function(){
    -                cfg.addFeature('myfeature');
    -                var features = cfg.doc.findall('feature');
    -                var featureNames = features.map(function(feature){
    -                    return feature.attrib.name;
    +            it('should read plugin given id', function(){
    +                var plugin = cfg.getPlugin('org.apache.cordova.justafeature');
    +                expect(plugin).toBeDefined();
    +                expect(plugin.name).toEqual('org.apache.cordova.justafeature');
    +                expect(plugin.variables).toBeDefined();
    +            });
    +            it('should not read plugin given undefined id', function(){
    +                var plugin = cfg.getPlugin('org.apache.cordova.undefinedfeature');
    +                expect(plugin).not.toBeDefined();
    +            });
    +            it('should read plugin with src', function(){
    +                var plugin = cfg.getPlugin('org.apache.cordova.featurewithurl');
    +                expect(plugin.src).toEqual('http://cordova.apache.org/featurewithurl');
    +            });
    +            it('should read plugin with version', function(){
    +                var plugin = cfg.getPlugin('org.apache.cordova.featurewithversion');
    +                expect(plugin.version).toEqual('1.1.1');
    +            });
    +            it('should read plugin variables', function () {
    +                var plugin = cfg.getPlugin('org.apache.cordova.featurewithvars');
    +                expect(plugin.variables).toBeDefined();
    +                expect(plugin.variables.var).toBeDefined();
    +                expect(plugin.variables.var).toEqual('varvalue');
    +            });
    +            it('should allow adding a new plugin', function(){
    +                cfg.addPlugin({name:'myfeature'});
    --- End diff --
    
    This test does not seem to test all the way to the filesystem. 
    
    You should use cfg.write() here to flush things to the filesystem, then reload from the
filesystem using the constructor.
    As it currently stands, we are just changing things in memory. But I suppose the goal
is to test the end-to-end scenario: from memory to filesystem and back.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message