Skip to content

Commit

Permalink
Serializer: Fix serializing attributes (use HTML format) (#682)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored May 5, 2017
1 parent 9c67862 commit cb0a82c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blocks/api/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function getCommentAttributes( realAttributes, expectedAttributes ) {
return memo;
}

return memo + `${ key }:${ value } `;
return memo + `${ key }="${ value }" `;
}, '' );
}

Expand Down
6 changes: 3 additions & 3 deletions blocks/api/test/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe( 'block serializer', () => {
fruit: 'bananas'
} );

expect( attributes ).to.equal( 'category:food ripeness:ripe ' );
expect( attributes ).to.equal( 'category="food" ripeness="ripe" ' );
} );

it( 'should not append an undefined attribute value', () => {
Expand All @@ -83,7 +83,7 @@ describe( 'block serializer', () => {
fruit: 'bananas'
} );

expect( attributes ).to.equal( 'category:food ' );
expect( attributes ).to.equal( 'category="food" ' );
} );
} );

Expand All @@ -109,7 +109,7 @@ describe( 'block serializer', () => {
}
}
];
const expectedPostContent = '<!-- wp:core/test-block align:left -->\n<p>Ribs & Chicken</p>\n<!-- /wp:core/test-block -->\n\n';
const expectedPostContent = '<!-- wp:core/test-block align="left" -->\n<p>Ribs & Chicken</p>\n<!-- /wp:core/test-block -->\n\n';

expect( serialize( blockList ) ).to.eql( expectedPostContent );
} );
Expand Down

0 comments on commit cb0a82c

Please sign in to comment.