Fixed up the file uploading and the readonly property editors and saving/updating their data/control based on the data changed on the server side.

U4-2680 Fix file uploading
This commit is contained in:
Shannon
2013-08-21 17:54:30 +10:00
parent 466b2a1cb2
commit 5581af2d25
17 changed files with 362 additions and 146 deletions

View File

@@ -36,23 +36,7 @@ describe('edit content controller tests', function () {
}));
describe('content edit controller save and publish', function () {
it('it should define the default properties on construction', function () {
expect(scope.files).toNotBe(undefined);
});
it('adding a file adds to the collection', function () {
scope.addFiles(123, ["testFile"]);
expect(scope.files.length).toBe(1);
});
it('adding a file with the same property id replaces the existing one', function () {
scope.addFiles(123, ["testFile"]);
scope.addFiles(123, ["testFile2"]);
expect(scope.files.length).toBe(1);
expect(scope.files[0].file).toBe("testFile2");
});
it('it should have an content object', function() {
//controller should have a content object

View File

@@ -218,9 +218,7 @@ describe('contentEditingHelper tests', function () {
newContent.tabs[1].properties[2].value = "origValue4";
//act
var changed = contentEditingHelper.reBindChangedProperties(
contentEditingHelper.getAllProps(origContent),
contentEditingHelper.getAllProps(newContent));
var changed = contentEditingHelper.reBindChangedProperties(origContent, newContent);
//assert
expect(changed.length).toBe(2);

View File

@@ -0,0 +1,33 @@
describe('file manager tests', function () {
var fileManager;
beforeEach(module('umbraco.services'));
beforeEach(inject(function ($injector) {
fileManager = $injector.get('fileManager');
}));
describe('file management', function () {
it('adding a file adds to the collection', function () {
fileManager.setFiles(123, ["testFile"]);
expect(fileManager.getFiles().length).toBe(1);
});
it('adding a file with the same property id replaces the existing one', function () {
fileManager.setFiles(123, ["testFile"]);
fileManager.setFiles(123, ["testFile2"]);
expect(fileManager.getFiles().length).toBe(1);
expect(fileManager.getFiles()[0].file).toBe("testFile2");
});
it('clears all files', function () {
fileManager.setFiles(123, ["testFile"]);
fileManager.setFiles(234, ["testFile"]);
expect(fileManager.getFiles().length).toBe(2);
fileManager.clearFiles();
expect(fileManager.getFiles().length).toBe(0);
});
});
});