|
1 | 1 | var pbx = require('../lib/pbxProject'),
|
| 2 | + pbxFile = require('../lib/pbxFile'), |
2 | 3 | project,
|
3 | 4 | projectHash;
|
4 | 5 |
|
@@ -137,6 +138,85 @@ exports.addGroupToGroup = {
|
137 | 138 | }
|
138 | 139 | }
|
139 | 140 |
|
| 141 | +exports.predefinedPbxGroups = { |
| 142 | + setUp: function(callback) { |
| 143 | + project = new pbx('test/parser/projects/empty-groups.pbxproj').parseSync(); |
| 144 | + |
| 145 | + this.file = new pbxFile('some-file.m'); |
| 146 | + this.file.fileRef = project.generateUuid(); |
| 147 | + project.addToPbxFileReferenceSection(this.file); |
| 148 | + |
| 149 | + callback(); |
| 150 | + }, |
| 151 | + |
| 152 | + 'should add a file to "Plugins" group': function(test) { |
| 153 | + project.addToPluginsPbxGroup(this.file); |
| 154 | + var foundInGroup = findChildInGroup(project.pbxGroupByName('Plugins'), this.file.fileRef); |
| 155 | + test.ok(foundInGroup); |
| 156 | + test.done(); |
| 157 | + }, |
| 158 | + |
| 159 | + 'should remove a file from "Plugins" group': function(test) { |
| 160 | + project.addToPluginsPbxGroup(this.file); |
| 161 | + project.removeFromPluginsPbxGroup(this.file); |
| 162 | + |
| 163 | + var foundInGroup = findChildInGroup(project.pbxGroupByName('Plugins'), this.file.fileRef); |
| 164 | + test.ok(!foundInGroup); |
| 165 | + test.done(); |
| 166 | + }, |
| 167 | + |
| 168 | + 'should add a file to "Resources" group': function(test) { |
| 169 | + project.addToResourcesPbxGroup(this.file); |
| 170 | + |
| 171 | + var foundInGroup = findChildInGroup(project.pbxGroupByName('Resources'), this.file.fileRef); |
| 172 | + test.ok(foundInGroup); |
| 173 | + test.done(); |
| 174 | + }, |
| 175 | + |
| 176 | + 'should remove a file from "Resources" group': function(test) { |
| 177 | + project.addToResourcesPbxGroup(this.file); |
| 178 | + project.removeFromResourcesPbxGroup(this.file); |
| 179 | + |
| 180 | + var foundInGroup = findChildInGroup(project.pbxGroupByName('Resources'), this.file.fileRef); |
| 181 | + test.ok(!foundInGroup); |
| 182 | + test.done(); |
| 183 | + }, |
| 184 | + |
| 185 | + 'should add a file to "Frameworks" group': function(test) { |
| 186 | + project.addToFrameworksPbxGroup(this.file); |
| 187 | + |
| 188 | + var foundInGroup = findChildInGroup(project.pbxGroupByName('Frameworks'), this.file.fileRef); |
| 189 | + test.ok(foundInGroup); |
| 190 | + test.done(); |
| 191 | + }, |
| 192 | + |
| 193 | + 'should remove a file from "Frameworks" group': function(test) { |
| 194 | + project.addToFrameworksPbxGroup(this.file); |
| 195 | + project.removeFromFrameworksPbxGroup(this.file); |
| 196 | + |
| 197 | + var foundInGroup = findChildInGroup(project.pbxGroupByName('Frameworks'), this.file.fileRef); |
| 198 | + test.ok(!foundInGroup); |
| 199 | + test.done(); |
| 200 | + }, |
| 201 | + |
| 202 | + 'should add a file to "Products" group': function(test) { |
| 203 | + project.addToProductsPbxGroup(this.file); |
| 204 | + |
| 205 | + var foundInGroup = findChildInGroup(project.pbxGroupByName('Products'), this.file.fileRef); |
| 206 | + test.ok(foundInGroup); |
| 207 | + test.done(); |
| 208 | + }, |
| 209 | + |
| 210 | + 'should remove a file from "Products" group': function(test) { |
| 211 | + project.addToProductsPbxGroup(this.file); |
| 212 | + project.removeFromProductsPbxGroup(this.file); |
| 213 | + |
| 214 | + var foundInGroup = findChildInGroup(project.pbxGroupByName('Products'), this.file.fileRef); |
| 215 | + test.ok(!foundInGroup); |
| 216 | + test.done(); |
| 217 | + } |
| 218 | +}; |
| 219 | + |
140 | 220 | exports.addSourceFileToGroup = {
|
141 | 221 | 'should create group + add source file' : function(test) {
|
142 | 222 | var testKey = project.pbxCreateGroup('Test', 'Test');
|
|
0 commit comments