-
Notifications
You must be signed in to change notification settings - Fork 1
only one line after expand button #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
14c8c57
Trim code to prevent creating new line
cherifGsoul 1e056c1
More fixes
cherifGsoul 3e7c4d9
fix tests
cherifGsoul 8a189b5
Debugging
cherifGsoul ff3f055
Debug for travis
cherifGsoul f0abffc
This test only
cherifGsoul 9ce4567
Checkout without the fix
cherifGsoul 27f3629
Update the fix to make the build pass
cherifGsoul 4cd0958
Fix changes
cherifGsoul 60c464d
Just use trim
cherifGsoul 7c6d54a
Pared down the markdown test file
cherifGsoul 6d98d88
Reduce markdown test file
cherifGsoul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| You can also set the `value` of the properties of `pageComponentViewModel` and verify that the `routeData` is updated correctly: | ||
|
|
||
| ```html | ||
| <div id="mocha"></div> | ||
| <link rel="stylesheet" href="//unpkg.com/mocha@5.2.0/mocha.css"> | ||
| <script src="//unpkg.com/mocha@5.2.0/mocha.js" type="text/javascript"></script> | ||
| <script src="//unpkg.com/chai@4.1.2/chai.js" type="text/javascript"></script> | ||
| <script type="module"> | ||
| import { Component, route, value, DefineMap } from "can"; | ||
|
|
||
| // Mocha / Chai Setup | ||
| mocha.setup("bdd") | ||
| var assert = chai.assert; | ||
|
|
||
| const HomePage = Component.extend({ | ||
| tag: "home-page", | ||
|
|
||
| view: ` | ||
| <h2>Home Page</h2> | ||
| `, | ||
|
|
||
| ViewModel: {} | ||
| }); | ||
|
|
||
| const ListPage = Component.extend({ | ||
| tag: "list-page", | ||
|
|
||
| view: ` | ||
| <h2>List Page</h2> | ||
| <p>{{ id }}</p> | ||
| `, | ||
|
|
||
| ViewModel: { | ||
| id: "number" | ||
| } | ||
| }); | ||
|
|
||
| const Application = Component.extend({ | ||
| tag: "app-component", | ||
|
|
||
| ViewModel: { | ||
| routeData: { | ||
| default() { | ||
| route.register("{page}", { page: "home" }); | ||
| route.register("list/{id}", { page: "list" }); | ||
| route.start(); | ||
| return route.data; | ||
| } | ||
| }, | ||
|
|
||
| get pageComponentViewModel() { | ||
| const vmData = {}; | ||
|
|
||
| if (this.routeData.page === "list") { | ||
| vmData.id = value.bind(this.routeData, "id"); | ||
| } | ||
|
|
||
| return vmData; | ||
| }, | ||
|
|
||
| get pageComponent() { | ||
| if (this.routeData.page === "home") { | ||
| return new HomePage(); | ||
| } else if (this.routeData.page === "list") { | ||
| return new ListPage({ | ||
| viewModel: this.pageComponentViewModel | ||
| }); | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| view: ` | ||
| {{ pageComponent }} | ||
| ` | ||
| }); | ||
|
|
||
| describe("Application", () => { | ||
| it("pageComponent viewModel", () => { | ||
| const routeData = new DefineMap({ | ||
| page: "home", | ||
| id: null | ||
| }); | ||
|
|
||
| const vm = new Application.ViewModel({ | ||
| routeData: routeData | ||
| }); | ||
|
|
||
| assert.deepEqual(vm.pageComponentViewModel, {}, "viewModelData defaults to empty object"); | ||
|
|
||
| routeData.update({ | ||
| page: "list", | ||
| id: 10 | ||
| }); | ||
|
|
||
| const viewModelId = vm.pageComponentViewModel.id; | ||
| assert.equal(viewModelId.value, 10, "routeData.id is passed to pageComponent viewModel"); | ||
|
|
||
| routeData.id = 20; | ||
|
|
||
| assert.equal(viewModelId.value, 20, "setting routeData.id updates the pageComponentViewModel.id"); | ||
|
|
||
| viewModelId.value = 30; | ||
| assert.equal(routeData.id, 30, "setting pageComponentViewModel.id updates routeData.id"); | ||
| }); | ||
| }); | ||
|
|
||
| // start Mocha | ||
| mocha.run(); | ||
| </script> | ||
| ``` | ||
| <span line-highlight='97-100,only'/> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed for the test? Can this be pared down at all?