From f1db789450c2282b2369678c3d53675990a28e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1ko=20Hevery?= Date: Fri, 6 Apr 2018 10:29:22 -0700 Subject: [PATCH] test(ivy): update todo app to http://todomvc.com (#23168) PR Close #23168 --- .../core/src/core_render3_private_export.ts | 1 + packages/core/test/bundling/todo/BUILD.bazel | 5 + .../test/bundling/todo/OUTSTANDING_WORK.md | 9 +- packages/core/test/bundling/todo/base.css | 141 +++++++ .../bundling/todo/bundle.golden_symbols.json | 165 +++----- packages/core/test/bundling/todo/index.html | 2 + packages/core/test/bundling/todo/index.ts | 182 ++++++--- packages/core/test/bundling/todo/todo.css | 377 ++++++++++++++++++ .../{treeshaking_spec.ts => todo_e2e_spec.ts} | 12 +- 9 files changed, 735 insertions(+), 159 deletions(-) create mode 100644 packages/core/test/bundling/todo/base.css create mode 100644 packages/core/test/bundling/todo/todo.css rename packages/core/test/bundling/todo/{treeshaking_spec.ts => todo_e2e_spec.ts} (60%) diff --git a/packages/core/src/core_render3_private_export.ts b/packages/core/src/core_render3_private_export.ts index a50c5e30a3..319c0a3d95 100644 --- a/packages/core/src/core_render3_private_export.ts +++ b/packages/core/src/core_render3_private_export.ts @@ -78,6 +78,7 @@ export { ComponentDef as ɵComponentDef, DirectiveDef as ɵDirectiveDef, PipeDef as ɵPipeDef, + whenRendered as ɵwhenRendered, } from './render3/index'; export { bypassSanitizationTrustHtml as ɵbypassSanitizationTrustHtml, diff --git a/packages/core/test/bundling/todo/BUILD.bazel b/packages/core/test/bundling/todo/BUILD.bazel index b4aafd601a..32186f674b 100644 --- a/packages/core/test/bundling/todo/BUILD.bazel +++ b/packages/core/test/bundling/todo/BUILD.bazel @@ -36,6 +36,7 @@ ts_library( srcs = glob(["*_spec.ts"]), deps = [ "//packages:types", + "//packages/core", "//packages/core/testing", ], ) @@ -75,6 +76,8 @@ ts_devserver( static_files = [ "index.html", ":tslib", + "todo.css", + "base.css", ], deps = [":todo"], ) @@ -87,5 +90,7 @@ ts_devserver( ":bundle.min_debug.js", ":bundle.min.js", "index.html", + "todo.css", + "base.css", ], ) diff --git a/packages/core/test/bundling/todo/OUTSTANDING_WORK.md b/packages/core/test/bundling/todo/OUTSTANDING_WORK.md index 2f1d4b7ff2..c2baf47676 100644 --- a/packages/core/test/bundling/todo/OUTSTANDING_WORK.md +++ b/packages/core/test/bundling/todo/OUTSTANDING_WORK.md @@ -2,7 +2,9 @@ ## `Todo` app - [X] Clicking archive removes todo item. -- [ ] Update `Todo` app to match http://todomvc.com/ +- [X] Update `Todo` app to match http://todomvc.com/. +- [ ] Make it work with `[(ngModel)]`. +- [ ] Make it work with `(keyup.Enter)`. ## Compiler - [ ] Remove ` tslib_1.__decorate([core_1.Input(), tslib_1.__metadata("design:type", Object)], TodoComponent.prototype, "todo", void 0);` from generated output. @@ -14,10 +16,13 @@ - [ ] `ViewContainerRef` must separate creation mode from update mode otherwise {{todo.done}} fails for `NgFor` because `todo` is not set during creation mode. - [ ] Injector should be optional +## Testing +- [ ] Create a debug mode which would publish components into DOM for easier writing of tests. + ## Bazel -- [ ] Have action verb on the `ng_rollup_bundle` to display sourcemaps. +- [ ] Have action verb on the `ng_rollup_bundle` to display source maps. # NOTES diff --git a/packages/core/test/bundling/todo/base.css b/packages/core/test/bundling/todo/base.css new file mode 100644 index 0000000000..9f6ac1bd74 --- /dev/null +++ b/packages/core/test/bundling/todo/base.css @@ -0,0 +1,141 @@ +hr { + margin: 20px 0; + border: 0; + border-top: 1px dashed #c5c5c5; + border-bottom: 1px dashed #f7f7f7; +} + +.learn a { + font-weight: normal; + text-decoration: none; + color: #b83f45; +} + +.learn a:hover { + text-decoration: underline; + color: #787e7e; +} + +.learn h3, +.learn h4, +.learn h5 { + margin: 10px 0; + font-weight: 500; + line-height: 1.2; + color: #000; +} + +.learn h3 { + font-size: 24px; +} + +.learn h4 { + font-size: 18px; +} + +.learn h5 { + margin-bottom: 0; + font-size: 14px; +} + +.learn ul { + padding: 0; + margin: 0 0 30px 25px; +} + +.learn li { + line-height: 20px; +} + +.learn p { + font-size: 15px; + font-weight: 300; + line-height: 1.3; + margin-top: 0; + margin-bottom: 0; +} + +#issue-count { + display: none; +} + +.quote { + border: none; + margin: 20px 0 60px 0; +} + +.quote p { + font-style: italic; +} + +.quote p:before { + content: '“'; + font-size: 50px; + opacity: .15; + position: absolute; + top: -20px; + left: 3px; +} + +.quote p:after { + content: '”'; + font-size: 50px; + opacity: .15; + position: absolute; + bottom: -42px; + right: 3px; +} + +.quote footer { + position: absolute; + bottom: -40px; + right: 0; +} + +.quote footer img { + border-radius: 3px; +} + +.quote footer a { + margin-left: 5px; + vertical-align: middle; +} + +.speech-bubble { + position: relative; + padding: 10px; + background: rgba(0, 0, 0, .04); + border-radius: 5px; +} + +.speech-bubble:after { + content: ''; + position: absolute; + top: 100%; + right: 30px; + border: 13px solid transparent; + border-top-color: rgba(0, 0, 0, .04); +} + +.learn-bar > .learn { + position: absolute; + width: 272px; + top: 8px; + left: -300px; + padding: 10px; + border-radius: 5px; + background-color: rgba(255, 255, 255, .6); + transition-property: left; + transition-duration: 500ms; +} + +@media (min-width: 899px) { + .learn-bar { + width: auto; + padding-left: 300px; + } + + .learn-bar > .learn { + left: 8px; + } +} \ No newline at end of file diff --git a/packages/core/test/bundling/todo/bundle.golden_symbols.json b/packages/core/test/bundling/todo/bundle.golden_symbols.json index 27608bd4b5..62c9287b50 100644 --- a/packages/core/test/bundling/todo/bundle.golden_symbols.json +++ b/packages/core/test/bundling/todo/bundle.golden_symbols.json @@ -1,10 +1,4 @@ [ - { - "name": "AnonymousSubject" - }, - { - "name": "AppState" - }, { "name": "CIRCULAR$2" }, @@ -32,9 +26,6 @@ { "name": "EmbeddedViewRef$1" }, - { - "name": "EventEmitter" - }, { "name": "IterableChangeRecord_" }, @@ -53,15 +44,15 @@ { "name": "NgForOfContext" }, + { + "name": "NgIf" + }, + { + "name": "NgIfContext" + }, { "name": "NgOnChangesFeature" }, - { - "name": "ObjectUnsubscribedError" - }, - { - "name": "Observable" - }, { "name": "Optional" }, @@ -77,30 +68,12 @@ { "name": "RecordViewTuple" }, - { - "name": "SafeSubscriber" - }, { "name": "SimpleChange" }, { "name": "SkipSelf" }, - { - "name": "Subject" - }, - { - "name": "SubjectSubscriber" - }, - { - "name": "SubjectSubscription" - }, - { - "name": "Subscriber" - }, - { - "name": "Subscription" - }, { "name": "TemplateRef$1" }, @@ -111,14 +84,14 @@ "name": "ToDoAppModule" }, { - "name": "TodoComponent" + "name": "Todo" + }, + { + "name": "TodoStore" }, { "name": "UNDEFINED_RENDERER_TYPE_ID" }, - { - "name": "UnsubscriptionError" - }, { "name": "ViewContainerRef$1" }, @@ -137,21 +110,6 @@ { "name": "__extends" }, - { - "name": "__extends$1" - }, - { - "name": "__extends$2" - }, - { - "name": "__extends$4" - }, - { - "name": "__extends$5" - }, - { - "name": "__extends$6" - }, { "name": "__global" }, @@ -174,10 +132,52 @@ "name": "_c1" }, { - "name": "_devMode" + "name": "_c10" }, { - "name": "_enable_super_gross_mode_that_will_cause_bad_things" + "name": "_c11" + }, + { + "name": "_c12" + }, + { + "name": "_c13" + }, + { + "name": "_c14" + }, + { + "name": "_c15" + }, + { + "name": "_c16" + }, + { + "name": "_c2" + }, + { + "name": "_c3" + }, + { + "name": "_c4" + }, + { + "name": "_c5" + }, + { + "name": "_c6" + }, + { + "name": "_c7" + }, + { + "name": "_c8" + }, + { + "name": "_c9" + }, + { + "name": "_devMode" }, { "name": "_getComponentHostLElementNode" @@ -206,6 +206,9 @@ { "name": "appendChild" }, + { + "name": "assertTemplate" + }, { "name": "baseDirectiveCreate" }, @@ -239,9 +242,6 @@ { "name": "componentRefresh" }, - { - "name": "config" - }, { "name": "container" }, @@ -314,15 +314,9 @@ { "name": "elementStart" }, - { - "name": "empty" - }, { "name": "enterView" }, - { - "name": "errorObject" - }, { "name": "executeHooks" }, @@ -362,9 +356,6 @@ { "name": "firstTemplatePass" }, - { - "name": "flattenUnsubscriptionErrors" - }, { "name": "generateInitialInputs" }, @@ -407,9 +398,6 @@ { "name": "getPreviousOrParentNode" }, - { - "name": "getPromiseCtor" - }, { "name": "getRenderer" }, @@ -428,9 +416,6 @@ { "name": "hostElement" }, - { - "name": "hostReportError" - }, { "name": "initBindings" }, @@ -458,9 +443,6 @@ { "name": "invertObject" }, - { - "name": "isArray" - }, { "name": "isCssClassMatching" }, @@ -470,9 +452,6 @@ { "name": "isDifferent" }, - { - "name": "isFunction" - }, { "name": "isJsObject" }, @@ -485,18 +464,12 @@ { "name": "isNodeMatchingSelectorList" }, - { - "name": "isObject" - }, { "name": "isPositive" }, { "name": "isProceduralRenderer" }, - { - "name": "isTrustedSubscriber" - }, { "name": "iterateListLike" }, @@ -506,6 +479,9 @@ { "name": "listener" }, + { + "name": "load" + }, { "name": "locateHostElement" }, @@ -524,18 +500,9 @@ { "name": "markViewDirty" }, - { - "name": "noop" - }, { "name": "notImplemented" }, - { - "name": "observable" - }, - { - "name": "pipeFromArray" - }, { "name": "queueComponentIndexForCheck" }, @@ -590,9 +557,6 @@ { "name": "resolveRendererType2" }, - { - "name": "rxSubscriber" - }, { "name": "saveNameToExportMap" }, @@ -641,18 +605,9 @@ { "name": "tick" }, - { - "name": "toSubscriber" - }, { "name": "trackByIdentity" }, - { - "name": "tryCatch" - }, - { - "name": "tryCatcher" - }, { "name": "viewAttached" }, diff --git a/packages/core/test/bundling/todo/index.html b/packages/core/test/bundling/todo/index.html index 0143a83674..304af5a248 100644 --- a/packages/core/test/bundling/todo/index.html +++ b/packages/core/test/bundling/todo/index.html @@ -4,6 +4,8 @@ Angular Todo Example + +