diff --git a/docs/sites-dropdown.component.md b/docs/sites-dropdown.component.md
index d522b1169f..8c4969a61f 100644
--- a/docs/sites-dropdown.component.md
+++ b/docs/sites-dropdown.component.md
@@ -9,6 +9,7 @@ Displays a dropdown menu to show and interact with the sites of the current user
- [Basic Usage](#basic-usage)
+ * [Properties](#properties)
* [Events](#events)
@@ -23,6 +24,12 @@ Displays a dropdown menu to show and interact with the sites of the current user
```
+### Properties
+
+| Attribute | Type | Default | Description |
+| --- | --- | --- | --- |
+| hideMyFiles | boolean | false | Hide the "My Files" option added to the list by default |
+
### Events
| Name | Returned Type | Description |
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.html b/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.html
index 5050c85add..d15d07f12c 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.html
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.html
@@ -1,11 +1,14 @@
-
- {{'DROPDOWN.DEFAULT_OPTION' | translate}}
+ {{'DROPDOWN.MY_FILES_OPTION' | translate}}
{{ site.title }}
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.spec.ts
index 0c7c4e6082..7d6b4f7e0e 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.spec.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.spec.ts
@@ -89,6 +89,11 @@ describe('DropdownSitesComponent', () => {
describe('Rendering tests', () => {
+ function openSelectbox() {
+ const selectBox = debug.query(By.css(('[data-automation-id="site-my-files-select"] .mat-select-trigger')));
+ selectBox.triggerEventHandler('click', null);
+ }
+
beforeEach(() => {
jasmine.Ajax.install();
});
@@ -96,6 +101,7 @@ describe('DropdownSitesComponent', () => {
afterEach(() => {
jasmine.Ajax.uninstall();
fixture.destroy();
+ TestBed.resetTestingModule();
});
it('Dropdown sites should be renedered', async(() => {
@@ -115,6 +121,31 @@ describe('DropdownSitesComponent', () => {
});
}));
+ it('should show the "My files" option by default', async(() => {
+ fixture.detectChanges();
+ jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, contentType: 'json', responseText: sitesList });
+
+ openSelectbox();
+
+ fixture.whenStable().then(() => {
+ fixture.detectChanges();
+ expect(window.document.querySelector('[data-automation-id="site-my-files-option"]')).not.toBeNull();
+ });
+ }));
+
+ it('should hide the "My files" option if the developer desires that way', async(() => {
+ component.hideMyFiles = true;
+ fixture.detectChanges();
+ jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, contentType: 'json', responseText: sitesList });
+
+ openSelectbox();
+
+ fixture.whenStable().then(() => {
+ fixture.detectChanges();
+ expect(window.document.querySelector('[data-automation-id="site-my-files-option"]')).toBeNull();
+ });
+ }));
+
// todo: something wrong with the test itself
xit('should load sites on init', async(() => {
fixture.detectChanges();
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.ts b/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.ts
index 4f93a0e523..02f94a6198 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/site-dropdown/sites-dropdown.component.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { Component, EventEmitter, OnInit, Output } from '@angular/core';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { SiteModel, SitesApiService } from 'ng2-alfresco-core';
@Component({
@@ -25,17 +25,19 @@ import { SiteModel, SitesApiService } from 'ng2-alfresco-core';
})
export class DropdownSitesComponent implements OnInit {
+ @Input()
+ hideMyFiles: boolean = false;
+
@Output()
change: EventEmitter = new EventEmitter();
- public DEFAULT_VALUE = 'default';
+ public MY_FILES_VALUE = 'default';
siteList = [];
public siteSelected: string;
- constructor(private sitesService: SitesApiService) {
- }
+ constructor(private sitesService: SitesApiService) {}
ngOnInit() {
this.sitesService.getSites().subscribe((result) => {
@@ -45,7 +47,7 @@ export class DropdownSitesComponent implements OnInit {
selectedSite() {
let siteFound;
- if (this.siteSelected === this.DEFAULT_VALUE) {
+ if (this.siteSelected === this.MY_FILES_VALUE) {
siteFound = new SiteModel();
}else {
siteFound = this.siteList.find( site => site.guid === this.siteSelected);
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/de.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/de.json
index f80802736d..0a0a98f980 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/de.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/de.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Site-Liste",
- "DEFAULT_OPTION": "Standard"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "Abbrechen",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/en.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/en.json
index 288e48c349..c1b3b5213f 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/en.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/en.json
@@ -33,7 +33,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Site List",
- "DEFAULT_OPTION": "Default"
+ "MY_FILES_OPTION": "My files"
},
"NODE_SELECTOR": {
"CANCEL": "Cancel",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/es.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/es.json
index a01201c888..a2f43b0fe4 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/es.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/es.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Lista de sitios",
- "DEFAULT_OPTION": "Predeterminada"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "Cancelar",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/fr.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/fr.json
index 9dfce41c59..8bf56a7a97 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/fr.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/fr.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Liste des Sites",
- "DEFAULT_OPTION": "Par défaut"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "Annuler",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/it.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/it.json
index 80df2963b8..7c74b9c6b0 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/it.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/it.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Elenco sito",
- "DEFAULT_OPTION": "Predefinito"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "Annulla",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/ja.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/ja.json
index 3964e24674..1cdf16c3bf 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/ja.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/ja.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "サイトリスト",
- "DEFAULT_OPTION": "デフォルト"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "キャンセル",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/nb.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/nb.json
index 530fb543e3..4d27d04521 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/nb.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/nb.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Områdeliste",
- "DEFAULT_OPTION": "Standard"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "Avbryt",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/nl.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/nl.json
index bc5d2938d4..2c57e92a65 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/nl.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/nl.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Lijst met sites",
- "DEFAULT_OPTION": "Standaard"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "Annuleren",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/pt-BR.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/pt-BR.json
index 855c7ec267..09a917d01a 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/pt-BR.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/pt-BR.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Lista do Site",
- "DEFAULT_OPTION": "Padrão"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "Cancelar",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/ru.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/ru.json
index 5c992446aa..4575fd0a76 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/ru.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/ru.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "Список сайтов",
- "DEFAULT_OPTION": "По умолчанию"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "Отмена",
diff --git a/ng2-components/ng2-alfresco-documentlist/src/i18n/zh-CN.json b/ng2-components/ng2-alfresco-documentlist/src/i18n/zh-CN.json
index 015149f8c6..ab1352c740 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/i18n/zh-CN.json
+++ b/ng2-components/ng2-alfresco-documentlist/src/i18n/zh-CN.json
@@ -27,7 +27,7 @@
},
"DROPDOWN": {
"PLACEHOLDER_LABEL": "网站列表",
- "DEFAULT_OPTION": "默认值"
+ "MY_FILES_OPTION": ""
},
"NODE_SELECTOR": {
"CANCEL": "取消",
diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts
index d414179508..fe4118b008 100644
--- a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts
+++ b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts
@@ -230,7 +230,7 @@ export class UploadButtonComponent implements OnInit, OnChanges, NodePermissionS
this.translateService.get('FILE_UPLOAD.MESSAGES.EXCEED_MAX_FILE_SIZE', {fileName: file.name}).subscribe((message: string) => {
this.error.emit(message);
- })
+ });
}
return acceptableSize;
diff --git a/scripts/README.md b/scripts/README.md
index de2fb805fc..a78bea09c3 100644
--- a/scripts/README.md
+++ b/scripts/README.md
@@ -145,6 +145,7 @@ The default behaviour of the ***npm-build-all.sh*** install node_modules and bui
| --- | --- |
| -h or --help | show the help |
| -t or --test | Run the tests, this parameter accepts also a wildcard to execute tests for example -t "ng2-alfresco-core" |
+| -d or --debug | Run the tests **in browser**, this parameter accepts also a wildcard to execute tests for example -d "ng2-alfresco-core" |
| -c or --clean | clean the ng2_components folders before start from all the temp builds files as node_modules |
| -gitjsapi | start the demo shell using an alfresco-js-api referenced by commit-ish version of the JS-API |
| -si or --skipinstall | skip the installation of the node_modules |
@@ -160,7 +161,13 @@ The default behaviour of the ***npm-build-all.sh*** install node_modules and bui
* Build all your local components and run the tests:
```sh
-./npm-build-all.sh -t or -test
+./npm-build-all.sh -t
+```
+
+* Build all your local components and run the tests **in BROWSER**:
+
+```sh
+./npm-build-all.sh -d
```
* Clean the ng2-components folder node_modules before build
diff --git a/scripts/npm-build-all.sh b/scripts/npm-build-all.sh
index c9c40ad799..f69d414b6e 100755
--- a/scripts/npm-build-all.sh
+++ b/scripts/npm-build-all.sh
@@ -3,6 +3,7 @@ set -f
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
eval RUN_TEST=false
+eval RUN_TESTBROWSER=false
eval EXEC_FAST_TEST=false
eval EXEC_CLEAN=false
eval EXEC_BUILD=true
@@ -34,13 +35,14 @@ eval projects=( "ng2-alfresco-core"
show_help() {
echo "Usage: npm-build-all.sh"
echo ""
- echo "-t or -test build all your local component and run also the test on them , this parameter accept also a wildecard to execute test for example -t "ng2-alfresco-core" "
- echo "-c or -clean the node_modules folder before to start the build"
- echo "-si or -skipinstall skip the install node_modules folder before to start the build"
- echo "-sb or skip build"
- echo "-ft or -fast test build all your local component and run also the test in one single karma-test-shim (high memory consuming and less details)"
- echo "-gitjsapi to build all the components against a commit-ish version of the JS-API"
- echo "-vjsapi install different version from npm of JS-API defined in the package.json"
+ echo "-t or --test Build your local components and run their tests, this parameter also accept a wildecard to execute test e.g: -t "ng2-alfresco-core"."
+ echo "-d or --debug Build your local components and run their tests IN THE BROWSER, this parameter also accept a wildecard to execute test e.g: -t "ng2-alfresco-core"."
+ echo "-c or --clean Clean the node_modules before starting the build."
+ echo "-si or --skipinstall Skip the install of node_modules before starting the build."
+ echo "-sb or --skipbuild Skip the build of ng-components."
+ echo "-ft or --fasttest Build all your local component and run also the test in one single karma-test-shim (high memory consuming and less details)"
+ echo "-gitjsapi Build all the components against a commit-ish version of the JS-API"
+ echo "-vjsapi Install different version from npm of JS-API defined in the package.json"
}
enable_test(){
@@ -53,11 +55,25 @@ enable_test(){
RUN_TEST=true
}
+enable_testbrowser(){
+ if [[ ! -z $1 ]]; then
+ if [[ $1 != "-"* ]]; then
+ SINGLE_TEST=$1
+ fi
+ fi
+ RUN_TESTBROWSER=true
+}
+
test_project() {
echo "====== test project: $1 ====="
npm run test -- --component $1 || exit 1
}
+debug_project() {
+ echo "====== debug project: $1 ====="
+ npm run test-browser -- --component $1 || exit 1
+}
+
enable_fast_test() {
EXEC_FAST_TEST=true
}
@@ -100,6 +116,7 @@ while [[ $1 == -* ]]; do
shift;
fi
;;
+ -d|--debug) enable_testbrowser $2; shift; shift;;
-ft|--fasttest) enable_fast_test; shift;;
-gitjsapi) enable_js_api_git_link $2; shift 2;;
-vjsapi) version_js_api $2; shift 2;;
@@ -165,4 +182,14 @@ if $RUN_TEST == true; then
done
fi
+if $RUN_TESTBROWSER == true; then
+ for PACKAGE in ${projects[@]}
+ do
+ DESTDIR="$DIR/../ng2-components/"
+ cd $DESTDIR
+ if [[ $PACKAGE == $SINGLE_TEST ]]; then
+ debug_project $PACKAGE
+ fi
+ done
+fi