Added unit tests.
Do only clear legends when modifying an extended palette.

Now we are compatible with MetaPalettes again.
Add test cases for palette extending.
Bugfix: do not use "while ($foo = next($bar))" as this skips the first element.
Merge pull request #16 from discordier/develop

Add support for sub select palettes mentioning legend names.
Merge pull request #17 from discordier/unit-tests

Add unit tests.
Merge pull request #18 from discordier/extend-palette-fix

Extend palette fix - including test cases.